6 ms·
I don’t see how BigInts can’t be serialized to JSON? Isn’t the “n” suffix exactly that — a serialization?
by dclowd9901 8y ago
I don’t see how BigInts can’t be serialized to JSON? Isn’t the “n” suffix exactly that — a serialization?
- thedufer 8y agoAn integer suffixed with the letter "n" is not valid JSON and will not parse if you follow the spec. The "n" suffix is how you write BigInts in JavaScript, not JSON.
- Spivak 8y agoHow JS chooses to show the string interpretation of the datatype has nothing to do with whether you can map the type into an abstract JSON number, which you can. JSON.stringify(1n) === "1" JSON.stringify(100000000000000000000n) === "100000000000000000000"