Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ColdFusion: QUERY to JSON

I have an query, which I want to convert to a JSON object.

Within my Query, there is a String (for example "0000" or "0001"). Unfortunately, after calling SerializeJSON, the String is a number (0, 1, ...).

I get an error when calling the functions with jQuery because the JSON object isn't valid. The quotation marks are fail:

{
   "COLUMNS": ["Test1","Test2","Test3"],
   "DATA": [ ["AA ",0000,"testestest"] ]
}

I already tried so many things. Can you help me?

Here is my code:

<cffunction name="getData" access="remote" returntype="any" returnformat="JSON">
    SQL....

    <cfset result = SerializeJSON(result)>

    <cfreturn result>
</cffunction>
like image 981
user1960845 Avatar asked Jan 09 '13 09:01

user1960845


1 Answers

This a ColdFusion 9 bug which had been registered in the Adobe ColdFusion (Bug ID 83638). You can upgrade your ColdFusion to ColdFusion 9.0.1 to resolve this issue. You need to just install the hot fix.

Visit the following URL for installing the hot fix.

http://helpx.adobe.com/coldfusion/kb/cumulative-hotfix-1-chf1-coldfusion.html

This fix is already added in ColdFusion 10.

like image 92
Abhisek Das Avatar answered Sep 18 '22 09:09

Abhisek Das