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

Support serializing bigint values #713

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

amccarthy1
Copy link

@amccarthy1 amccarthy1 commented Aug 4, 2023

Fixes #662

The available JSON serialization utilities do not natively support stringifying BigInt values, but they do support passing replacer arguments for serialization of custom or unsupported types.

In order not to crash when serializing BigInt values, we can pass a replacer function that substitutes these values to a string representation. The chosen format is 12345n, which aligns with most other string representations, as well as the shorthand syntax in later versions of JavaScript.

The available JSON serialization utilities do not natively support `stringify`ing `BigInt` values,
but they do support passing replacer arguments for serialization of custom or unsupported types.

In order not to crash when serializing BigInt values, we can pass a replacer function that substitutes
these values to a string representation. The chosen format is `12345n`, which aligns with most other
string representations, as well as the shorthand syntax in later versions of JavaScript.
@amccarthy1
Copy link
Author

@trentm sorry to pester you on this. Any interest in getting this quick fix merged? I understand if not, but would be helpful to know if I should spend any more time on this.

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 this pull request may close these issues.

Stringify BigInts
1 participant