Coldfusion: How to pass struct and array in a URL

Coldfusion: How to pass struct and array in a URL

A user just asked:

I need to pass my array to a webserver. But somehow, the array passed with cfhttp throws an error. Please help

You can not pass a structure or an array in a URL as they are complex values and Coldfusion does not have a way to convert them to simple string values (this is what you need to pass in a URL).

The only way to pass complex values is to serialize the Coldfusion struct or array for the URL. Fortunately, Coldfusion has a built in function called “SerializeJSON” to create a simple string. On the other hand, you can convert the simple string back to a struct or array with “DeserializeJSON”.

Here is a simple example how to pass a 2 dimensional array with cfhttps:

Helpmonks All-in-one Customer Service Platform
OpenBD and MongoDB: Can't get easier then this

I'm currently working on a project that uses MongoDB (yes, that's the awesome NoSQL database everyone talks about). Now, my favorites language of choice (CFML) and especially my favorite open source CFML engine OpenBD, has support for MongoDB built in which makes it a snap to use for any ColdFusion…

Helpmonks All-in-one Customer Service Platform
Why Coldfusion / CFML has its place and is worth to learn it

I actually never indulge in conversations why one programming language is better then another, because what is right to you, does not automatically mean, it is right for someone else. So, for me ColdFusion, or as we call the language itself - CFML, works very well. Nevertheless, in this post…

Helpmonks All-in-one Customer Service Platform
Select all checkboxes with JQuery

More then once you need to select all checked checkboxes in your web application. With JQuery this is a piece of cake. The following code returns all the checked checkbox values in an array AND in a string; [javascript]