JSON support for BigInt in ES6.

Anders Rundgren anders.rundgren.net at gmail.com
Tue Aug 14 13:56:28 UTC 2018


On 2018-08-14 15:34, Michał Wadas wrote:
> Personally, I would like to see:
> - third argument to JSON.parse reviver, "raw string"
> - new class JSON.Fragment accepting any syntactically valid JSON in constructor (eg. new JSON.Fragment('99999999999999999')
> - returning JSON.Fragment from JSON.stringify would paste it as-it-is into string output
> 
> This should cover any Bigint use case without breaking backward compatibility.

Would it be possible adding a little bit more meat to this? I didn't understand the "raw string" part :-(

JSON.Fragment seems like a more universalized version of JSONNumber.

BTW, my proposal is in fact designed to be 100% backward compatible.

Anders



More information about the es-discuss mailing list