Problem:
DeserializeJSON() does not preserve BigDecimal number. It deserializes to float. Currently serializeJSON() and deserializeJSON() is very hard to use when large number is needed to be serialized. To workaround the convert to float, one can use javacast("bigdecimal",num). However, there's no workaround to deserialize the number into a bigdecimal.
Method:
<cfscript>
x = javacast('bigDecimal',4111111111111111);
y = serializeJSON(x);
z = deserializeJSON(y);
writeDump(x);
writeoutput("<br>");
writeDump(y);
writeoutput("<br>");
writeDump(z);
</cfscript>
Result:
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3041279
External Customer Info:
External Company:
External Customer Name: Henry Ho
External Customer Email: 237A22C24921EDF5992015B9
External Test Config: 04/05/2010
Attachments:
Comments: