the data to stringify
the number of spaces to use in
Without modifications, JSON.stringify
has several shortcomings in
debugging and logging usage:
bigint
Uint8Array
s are often encoded in base 10 with newlines between each
index itemfunctions
and symbols
are not clearly markedThis method is more helpful in these cases:
bigint
: 0n
→ <bigint: 0n>
Uint8Array
: Uint8Array.of(0,0)
→ <Uint8Array: 0x0000>
function
: (x) => x * 2
→ <function: (x) => x * 2>
symbol
: Symbol(A)
→ <symbol: Symbol(A)>
Generated using TypeDoc
A safe method to
JSON.stringify
a value, useful for debugging and logging purposes.