I have ColdFusion 9.0.1 with the latest hotfix (4). I need ColdFusion to return all JSON data with quotes around them (as strings). I have the following problem:
<cfset test = StructNew()>
<cfset test.name = "1234.100">
<cfoutput>#SerializeJSON(test)#</cfoutput>
The text that is outputted is:
{"name":1234.100}
Every javascript JSON parser converts that to 1234.1 and is not keeping the trailing 0's. I either need ColdFusion to output as string or a javascript parser to keep the trailing 0's. Any ideas?
This is a simplified example. I am grabbing this data from a database.
If you don't want to use a kludge, you can use a third party library that encodes JSON correctly. I used JSONUtil from http://jsonutil.riaforge.org/. I am using ColdFusion 9 so I don't know if the more recent versions of ColdFusion have fixed some of the encoding abnormalities.