JSON support for BigInt in Chrome/V8

Anders Rundgren anders.rundgren.net at gmail.com
Tue Jul 17 17:11:30 UTC 2018


On 2018-07-17 17:44, Cyril Auburtin wrote:
> It would be great to have
> ```js
> JSON.stringify({x: 5n, y: BigInt('6')}) === '{"x":5n,"y":6n}'
> JSON.parse('{"x": 3n}') // {x: 3n}
> ```
> I don't know how feasable it would be, maybe have a new JSON5 object if JSON can't be changed for some reasons

If compatibility with other platforms which already have addressed this issue is an objective, there are essentially only three workable schemes:

- Use JSON exactly as specified [*]; without restrictions on numbers.  Example: Microsoft's Json.NET.

- Use an adaptive I-JSON scheme.  Example: Oracle's JSON-B.

- Use use a normalized I-JSON scheme.  Example: Close to a de-facto standard for systems targeting multiple platforms as well as for [probably all] IETF standards defining JSON structures.

Anders

*] Ignoring footnote-like interoperability considerations for JSON numbers.

> 
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
> 



More information about the es-discuss mailing list