Skip to main content
Version: 10.8.0

Function: parse()

parse(str): any

Defined in: src/utils/json.ts:27

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​

str​

string

JSON string

Returns​

any

Parsed json object

Example​

const str = '[123, 12.3, 11223344556677889900]';
const result = parse(str);
// result = [123, 12.3, 11223344556677890048n]