|
|
|
|
|
by mr_crankypants
2526 days ago
|
|
It's perhaps less a limitation of JSON and more a limitation of JavaScript itself[1]. But still, given that easy consumption from JavaScript is the ultimate primordial reason for choosing JSON over other formats, it seems like trying to transmit integers with more than 53 bits of precision over JSON is asking for trouble. Because it's only a matter of time until someone will want to do something like write a new service in Node, and the JavaScript parsers for other formats are at least somewhat more likely to guide people toward using BigInt for large integers. [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... |
|
I explicitly asked for and achieved step 2. in the modified SerializeJSONProperty algorithm[1] so that users could decide and opt-in to serializing BigInts as strings if they so choose, with or without some sigil that could be interpreted by a reviver function. e.g.:
[1]: https://tc39.es/proposal-bigint/#sec-serializejsonproperty