Skip to content

Support serializing bigint values#713

Open
amccarthy1 wants to merge 1 commit intotrentm:masterfrom
amccarthy1:bigint-support
Open

Support serializing bigint values#713
amccarthy1 wants to merge 1 commit intotrentm:masterfrom
amccarthy1:bigint-support

Conversation

@amccarthy1
Copy link
Copy Markdown

@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
Copy Markdown
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