tracker issue : CF-3338825

select a category, or use search below
(searches all categories and all time range)

SerializeJSON casts multiple zero value as number instead of string

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Kory Gorsky / Kory Gorsky (Kory Gorsky)

Created: 09/28/2012

Components: AJAX

Versions: 10.0

Failure Type:

Found In Build/Fixed In Build: Final / 285090

Priority/Frequency: Normal / Unknown

Locale/System: English / Windows 7 64-bit

Vote Count: 6

When using serializejson on an object that contains a string made up of multiple zeros, ie, "000", CF serializes it as a number value but leaves the leading zeros, which is improper JSON structure and throws a parse error on an ajax call.

This issue occurs in all browsers, since the serializeJson function is server-side, however it does not throw a js error in IE.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3338825


External Customer Info:
External Company:  
External Customer Name: Kory Gorsky
External Customer Email:


  1. November 06, 2012 00:00:00:


Here's example code to reproduce the issue: <cfsetting enablecfoutputonly="true"> <cfif not isdefined('url.json')> <cfoutput> <script language="javascript" src=""></script> <script language="javascript"> $.ajax({ type: 'POST', url: '?json', data: {}, success: function(){ document.write('Success!'); console.log(arguments); }, error: function(obj, err, errObj) { document.write('Error! [' + err + ']'); console.log(arguments); }, dataType: 'json' }); </script> </cfoutput> <cfelse> <cfset local.object = { root = { myvalue = "000" } } /> <cfoutput>#(serializeJSON(local.object))#</cfoutput> </cfif> </cfsetting>?
Comment by External U.
17841 | September 28, 2012 12:11:21 PM GMT
I am experiencing the same issue. We purchased Coldfusion 10 for our production environment, but we can't migrate from CF9 until this issue is resolved.
Vote by External U.
17852 | November 05, 2012 12:00:35 PM GMT
Same issue as
Vote by External U.
17853 | November 05, 2012 12:02:33 PM GMT
I'm experiencing this problem on ColdFusion 10. Please fix!
Comment by External U.
17842 | November 07, 2012 05:24:02 PM GMT
I am having this exact same issue. I'm trying to find a work around. I'm on CF10. Please fix Adobe or offer a recommended alternative!
Vote by External U.
17854 | November 07, 2012 05:25:52 PM GMT
Here is my JSON code. If you go to and plug this code in, it will show you the error. [ { "ismain": 1, "vendoruid": "40A84C12-0C05-40B8-8277-883AEB6D1205", "name": 1, "countryuid": "7BF88361-A217-499B-AE8B-5C4A040E20D8", "contactuid": "DFD5774E-B7FC-4145-9603-1038CFF46A38", "primaryphone": 1, "type": 1, "emailaddress": 1, "secondaryphone": 1 } ]
Comment by External U.
17843 | November 07, 2012 05:27:02 PM GMT
Woops, I posed the wrong snippit below. Here is the one that errors. [ { "ismain": 1, "vendoruid": "40A84C12-0C05-40B8-8277-883AEB6D1205", "name": 00, "countryuid": "B8FF06FA-9BEC-4F74-9104-6A6835D5880D", "contactuid": "3AAE0C8A-7C50-42AA-8359-14BAF10AA40B", "primaryphone": 00, "type": 00, "emailaddress": 00, "secondaryphone": 00 } ]
Comment by External U.
17844 | November 07, 2012 05:28:56 PM GMT
I can confirm this issue. Here's a snippet of my JSON: "SUBGROUPCODE":[000,000,000,"001","001","001","001","001","001","001","001","001","001","001","001","001","001","001","001","001"
Comment by External U.
17845 | December 13, 2012 04:22:40 PM GMT
Same issue as CF-3337487, Serious issue for us.
Vote by External U.
17855 | December 17, 2012 09:41:58 AM GMT
Temporary Fix for the issue is to serialize, then deserialize, then serialize it again. I can confirm this works. serializeJSON(deserializeJSON(serializeJSON(myQuery,true)))
Comment by External U.
17846 | December 17, 2012 12:53:17 PM GMT
Any updates on this issue? It's been 3 months since this was first reported. This isn't an issue where we just don't like the way that it's converting types; the generated json is actually invalid.
Comment by External U.
17847 | December 27, 2012 04:30:04 PM GMT
We had added a flag to roll back to old behavior of JSON serialization. One need to add a system property json.numberasdouble=true to jvm config. Note: currently there are quite a few system property in CF_HOME/cfusion/bin/jvm.config. “-Djava.awt.headless=true” is one of them. They can add the suggested flag just after former entry as -Djson.numberasdouble=true
Comment by Awdhesh K.
17848 | March 07, 2013 12:18:40 AM GMT
We have this as well and would like to see a resolution.
Vote by External U.
17856 | April 29, 2013 01:53:47 PM GMT
This issue is causing my company problems at the moment. We are working around it by appending a space to certain values to force them to be serialized as strings, but that's incredibly awkward and adds extra code. Please fix this bug.
Vote by External U.
17857 | April 29, 2013 01:58:28 PM GMT
What other implications are there to using the 'old behavior'? Is this meant as a substitute for a proper fix?
Comment by External U.
17849 | April 29, 2013 01:58:38 PM GMT
Will this fix in build 285090 be available in a hotfix? I see 10.0.10 is only up to: 10,0,10,284825.
Comment by External U.
17850 | June 17, 2013 05:02:56 PM GMT
Yes, in the next update
Comment by Vamseekrishna N.
17851 | June 17, 2013 11:34:17 PM GMT