Title:
Calling serializeJSON on a string of zeros (e.g. "000") doesn't string-encode the output.
| View in TrackerDuplicate ID: CF-3321476
Problem Description:
Calling serializeJSON on a string containing just zeros (e.g. "000") will result in a non-string output of 000.
The JSON specification (see: http://json.org/) specifies that a number value must only start with a single zero, and then only if it is directly followed by a period (.) or exponent (e). ColdFusion's serialisation of "000" to a number value 000 does not conform to the JSON specification, which means that parsers which expect conformity will fail to parse the JSON string. This issue therefore affects interoperability between ColdFusion and system components written in other languages, as well as JSON-based data stores like MongoDB.
Note also that CF's deserializeJSON function will parse the JSON output from serializeJSON("000") but will result in the (incorrect) output of "0" (i.e. the string of zeros has been truncated).
Steps to Reproduce:
<cfoutput>#serializejson("000")#</cfoutput>
Actual Result:
000
Expected Result:
"000"
Any Workarounds:
None known.
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3219537
External Customer Info:
External Company:
External Customer Name: Psionix
External Customer Email:
External Test Config: My Hardware and Environment details:
OS X Lion, running CF 9,0,2,282541.
Attachments:
Comments: