Json
constJson:object
Defined in: Data/Json.ts:24
Pure, non-throwing JSON utilities.
Wraps runtime JSON parsing and stringifying in typed Result containers.
Type Declaration
Section titled “Type Declaration”parse: (
text) =>Result<SyntaxError,unknown>
Safely parses a JSON string into unknown.
Converts thrown exceptions into a Result<SyntaxError, unknown>.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Result<SyntaxError, unknown>
Example
Section titled “Example”stringify
Section titled “stringify”stringify: (
value,replacer?,space?) =>Result<TypeError,string>
Safely stringifies a value into a JSON string.
Converts thrown exceptions (e.g. circular references) into a Result<TypeError, string>.
Parameters
Section titled “Parameters”unknown
replacer?
Section titled “replacer?”(this, key, value) => any
space?
Section titled “space?”string | number
Returns
Section titled “Returns”Result<TypeError, string>