Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any plans to support larger than 53-bit integers? #278

Open
johnnysprinkles opened this issue Nov 5, 2017 · 3 comments
Open

Any plans to support larger than 53-bit integers? #278

johnnysprinkles opened this issue Nov 5, 2017 · 3 comments

Comments

@johnnysprinkles
Copy link

Integers larger than 53 bits are valid JSON, but when parsed by JSON.parse they get truncated down to 53 bits and lose a few least significant digits. We have 64 bit integers coming from our backend and use https://www.npmjs.com/package/json-bigint to parse, any chance of adding an option for replace the built-in JSON.parse with a custom function, or just a boolean option for using json-bigint?

@kjvalencik
Copy link

Should just need to provide an option defaulted to JSON.parse. Then you can bring your own JSONBigInt parser.

parser = opts.parser || JSON.parse;

@kjvalencik
Copy link

Adding a parser option does make the reviver option redundant since it could be accomplished with:

{
    parser : body => JSON.parse(body, reviver)
}

@johnnysprinkles
Copy link
Author

johnnysprinkles commented Nov 22, 2017

Right on, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants