Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

stringify should throw when serializing a BigInt like JSON.stringify does #273

Copy link
Copy link
@jordanbtucker

Description

@jordanbtucker
Issue body actions

stringify should throw an error when serializing a BigInt to match JSON behavior.

const json = JSON.stringify(123n)
// Uncaught TypeError: Do not know how to serialize a BigInt

const json5 = JSON5.stringify(123n)
// json5 == undefined

In order to serialize a BigInt, one could use a replacer function that converts a BigInt to either a number or a string. Alternatively, we could add an option to stringify that enables BigInt support.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.