Function: jsonStringify()
jsonStringify(
value:unknown,space?:string|number):string
Defined in: utils.ts:197
JSON.stringify that drops circular references (via createUncircularReplacer)
and serializes bigints as bare JSON numbers, preserving full precision so a
uint64/uint256 survives the round-trip to Go without becoming a decimal string.
plain number integers are also tagged with .0 suffix, to differentiate them from bigints.
Parameters
| Parameter | Type |
|---|---|
value | unknown |
space? | string | number |
Returns
string
Example
TypeScript
jsonStringify({ a: 1n, b: 2, c: { d: 3n } }) // '{"a":1,"b":2.0,"c":{"d":3}}'
yaml.parse('{"a":1,"b":2.0,"c":{"d":3}}', { intAsBigInt: true }) // { a: 1n, b: 2, c: { d: 3n } }