Currently, JSON.stringify
only accepts numbers and JSON.parse
only returns numbers. Could this be updated to support bigints?
JSON.parseStrict
would return bigints for 1
/1.0
/etc., and JSON.stringifyStrict
would emit floats as 1.0
and bigints as 1
. Otherwise, they're basically identical.
The use case is 1. differentiating between the two (uncommon but sometimes useful), 2. being able to read very large integers accurately, and 3. better interop with dynamic but strongly-typed languages like Kotlin that also run in the browser with broad high-level JS interop.