fun fact: that's JavaScript. JavaScript only supports double-precision 64-bit binary format IEEE 754.
But JSON doesn't disallow arbitrary precision numbers, that's up to the parser implementation.
number
integer fraction exponent
In fact not all implementations support IEEE 754 doubles, and, from my experience, when dealing with money and rounding errors, many decide to serialize numbers as exact strings and use custom code for deserialization.
> when dealing with money and rounding errors, many decide to serialize numbers as exact strings and use custom code for deserialization
That's exactly what I'm doing. And indeed another reason why I feel embarrassed by JSON. I mean, we -the industry- have been doing financial data transport over computer networks, for how long now? fifty years? And we keep "inventing" transport formats that unsolve issues that have long been solved and done. XML had this solved[1]. Hell, even the ancient MT940[2] had this solved.
But JSON doesn't disallow arbitrary precision numbers, that's up to the parser implementation.
In fact not all implementations support IEEE 754 doubles, and, from my experience, when dealing with money and rounding errors, many decide to serialize numbers as exact strings and use custom code for deserialization.