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.
@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.
Fixes #662
The available JSON serialization utilities do not natively support
stringify
ingBigInt
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.