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

Uncaught TypeError: Do not know how to serialize a BigInt #36377

Closed
taoqf opened this issue Dec 4, 2020 · 1 comment
Closed

Uncaught TypeError: Do not know how to serialize a BigInt #36377

taoqf opened this issue Dec 4, 2020 · 1 comment

Comments

@taoqf
Copy link

taoqf commented Dec 4, 2020

Is your feature request related to a problem? Please describe.

JSON.stringify({key:1n});

throws:

Uncaught TypeError: Do not know how to serialize a BigInt
    at JSON.stringify (<anonymous>)

Describe the solution you'd like

"{\"key\":1n}"

Describe alternatives you've considered

when call JSON.parse the string, it should convert back to {key:1n}.

@devsnek
Copy link
Member

devsnek commented Dec 4, 2020

This is working as intended, bigints are not supported by JSON. See https://github.com/tc39/proposal-json-parse-with-source for a WIP solution.

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

No branches or pull requests

2 participants