logoalt Hacker News

sheepttoday at 10:03 AM1 replyview on HN

This can be avoided by supplying a reviver:

    const json = '{ "a": 9007199254740993 }'
    JSON.parse(json, (_key, value, context) => /^\d+$/.test(context.source) ? BigInt(context.source) : value)

Replies

tyretoday at 6:27 PM

Which can be avoided by using UUIDs

show 1 reply