Search code examples
jsoncoldfusiondeserializationcoldfusion-8

Coldfusion 8 truncates number in JSON string but ColdFusion 10 does not


This string:

{"status":"ok","payload":{"total pages":1,"page":1,"total entities":1,"queryId":"1e93eb52-7421-4706-8eb9-f41f8ce7ff06","entities":[{"Entity ID":694000000269197}]}}

when run through deserializeJson in CF10 produces what you would expect, but in CF8 the entities[1]['Entity ID'] results in 6.94000000269E+014.

What's going on and how can I get it to return the real number.


Solution

  • I used the CFLIB http://www.cflib.org/udf/jsondecode function instead of CF8s deserializeJSON function assuming it was just parsing the data wrong after reading this post: Coldfusion SerializeJSON and deSerializeJSON is converting a string to number