3 ms·
Firefox: >JSON.stringify(1n) TypeError: BigInt value can't be serialized in JSON Chrome: >JSON.stringify(1n) Uncaught TypeError: Do not know
by howdydoo 7y ago
Firefox:
>JSON.stringify(1n)
TypeError: BigInt value can't be serialized in JSON
Chrome:
>JSON.stringify(1n)
Uncaught TypeError: Do not know how to serialize a BigInt
at JSON.stringify (<anonymous>)
at <anonymous>:1:6
I don't think we're quite there yet.
- megous 7y agoIt was counterpoint to "that does not mean that JSON itself or all implementations have the specific limits of javascript." Javascript can do arbitrary precision integers now. So the last part is not true. You can generate your JSON strings with string concatenation in JS if you like. Just because JSON.stringify has some limit doesn't mean JS has.
- apaprocki 7y agoSee my comment elsewhere in the thread that shows how to properly use BigInts with JSON.stringify, if you choose to support them in your environment.