Skip to main content

Function: tryParseJSON()

tryParseJSON(value: string, reviver?: (this: object, key: string, value: unknown) => unknown): object | string | number | boolean | null

Try parse a stringified JSON string.

Parameters

ParameterTypeDescription
valuestringThe string to parse as JSON.
reviver?(this: object, key: string, value: unknown) => unknownA function that transforms the results. This function is recursively called for each member of the object.

Returns

object | string | number | boolean | null

Source

lib/tryParseJSON.ts:6