View Full Version : Saving grid data with coldfusion (format issue)

2 Dec 2009, 7:31 AM
Hi All,

I'm calling a coldfusion cfc to handle my database work. I have noticed a ext JSON formatting issue and was wondering if any other coldfusion users have come across it.

If I edit multiple rows, my json returns with the square brackets, and my deserializeJSON() function will work just fine:


If I only edit one row, the json returns without the square brackets and it does not parse correctly:


I know I could detect and add the square brackets server side, but it feels a little sloppy. Any other cf/ext people out there?


18 Jan 2010, 12:12 PM
Anyone? I thought I had some CF pals around here! ;)

18 Jan 2010, 3:16 PM
There are many ways to attack this. I am no CF expert, neither do I know what you are really doing.

You can do several things to alleviate the problem.

Can you not detect whether the object you receive is an Object or an array in your deserializeJSON() function? Your function should be able to accept both an Array or Object.

Or you can intercept the request and modify it to wrap the object in an Array. These seem to be the two options you have. Either way one has to give.