Title:
CFC Returning a string with an E and surrounded by numbers as a JSON numeric value (without quotes)
| View in TrackerStatus/Resolution/Reason: Closed/Withdrawn/Duplicate
Reporter/Name(from Bugbase): JJ BLODGETT / JJ BLODGETT ()
Created: 08/23/2017
Components: Language, CF Component
Versions: 2016,11.0
Failure Type: Incorrectly functioning
Found In Build/Fixed In Build: 2016.0.03.300466 / NA
Priority/Frequency: Major / All users will encounter
Locale/System: English / Win 2012 Server x64
Vote Count: 4
Problem Description:
CFC returns a structure as JSON to browser. If any individual keys have a value that is all numeric with a single "e" (case insensitive) in any position other than the first or last, the JSON that is returned will not be enclosed in quotes. So CF appears to be treating it as a scientific notation. This becomes a problem by anything that consumes the JSON since it thinks the value is a number. For example, browsers treat "2E2" as 200, and any "larger" scientifically notated numbers as "Infinity."
Steps to Reproduce: Create a CFC with a function that returns a structure as JSON. Create a string such as "2E2", "1234E56", etc. Then consume the function in a browser.
Actual Result: CF structure of {"test"="2E2"} is sent to browser in JSON as {"test": 2E2};
CF structure of {"test"="1234E56"} is sent to browser in JSON as {"test": 1234E56}
Expected Result: {"test"="2E2"} should be {"test": "2E2"};
{"test"="1234E56"} should be {"test": "1234E56"};
Any Workarounds: Other than adding characters to the string to make it not appear to be scientific notation, we are not aware of any workarounds. But in our case, we are dealing with Encrypted strings in HEX so adding characters breaks the ability to Decrypt the strings correctly.
Attachments:
- August 23, 2017 00:00:00: testInfJson.cfm
Comments: