Skip to main content
Version: Next

Namespace: json

Functions

parse

parse(x): any

Convert JSON string to JSON object

NOTE: the String() wrapping is used so the behavior conforms to JSON.parse() which can accept simple data types but is not represented in the default typing

Parameters

NameTypeDescription
xstringJSON string

Returns

any

Defined in

src/utils/json.ts:21


parseAlwaysAsBig

parseAlwaysAsBig(x): any

Convert JSON string to JSON object with all numbers as bigint

Parameters

NameTypeDescription
xstringJSON string

Returns

any

Defined in

src/utils/json.ts:27


stringify

stringify(value, replacer?, space?, numberStringifiers?): string

Convert JSON object to JSON string

NOTE: the not-null assertion is used so the return type conforms to JSON.stringify() which can also return undefined but is not represented in the default typing

Parameters

NameType
valueunknown
replacer?any
space?string | number
numberStringifiers?NumberStringifier[]

Returns

string

JSON string

Defined in

src/utils/json.ts:37


stringifyAlwaysAsBig

stringifyAlwaysAsBig(value, replacer?, space?, numberStringifiers?): string

Deprecated

equivalent to 'stringify', alias will be removed

Parameters

NameType
valueunknown
replacer?any
space?string | number
numberStringifiers?NumberStringifier[]

Returns

string

Defined in

src/utils/json.ts:37