Function stringify
- stringify(value, spacing?): string
Parameters
value: any
the data to stringify
spacing: number = defaultStringifySpacing
the number of spaces to use in
Returns string
Remarks
Without modifications,
JSON.stringifyhas several shortcomings in debugging and logging usage:- throws when serializing anything containing a
bigint Uint8Arrays are often encoded in base 10 with newlines between each index itemfunctionsandsymbolsare not clearly marked
This 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.stringifya value, useful for debugging and logging purposes.