2 ms·
> you have either an integer, a float or a string. JSON doesn't have "integers" and "floats", it has "numbers" which are are expressed in decimal scientific n
by nly 9y ago
> you have either an integer, a float or a string.
JSON doesn't have "integers" and "floats", it has "numbers" which are are expressed in decimal scientific notation. There's no guarantee an implementation will let you distinguish what was parsed, and the numerical precision and range of interoperable JSON is undefined.
The bottom line is JSON is a risky proposition for financial or scientific data exchange.
And before you say JSON numbers are de-facto IEEE754 doubles, bare in mind that most JSON implementations can't roundtrip them properly.[0] A symptom of everybody wanting to write a toy implementation.
[0] https://rawgit.com/miloyip/nativejson-benchmark/master/sample/conformance.html https://rawgit.com/miloyip/nativejson-benchmark/master/sampl...