jsonStringifySafe
Call Signature
Section titled “Call Signature”jsonStringifySafe<
T>(value,replacer?,space?,options?):JsonStringifyResult<T>
Defined in: packages/core/src/json/json-stringify-safe.ts:26
Stringify a value to a JSON string, handling circular references, Error objects, and BigInt values gracefully.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”T
The value to stringify.
replacer?
Section titled “replacer?”(string | number)[] | null
A function that alters the behavior of the stringification process, or an array of String and Number objects that serve as a whitelist for selecting/filtering the properties of the value object to be included in the JSON string. If this value is null or not provided, all properties of the object are included in the resulting JSON string.
space?
Section titled “space?”string | number
The number of spaces to use for indentation or a string to use as whitespace.
options?
Section titled “options?”JsonMakeAllReplacersFunctionOptions
Options to customize the behavior of the stringification, such as handling circular references.
Returns
Section titled “Returns”A JSON string representation of the value, or undefined if the value cannot be stringified.
Call Signature
Section titled “Call Signature”jsonStringifySafe(
value,replacer?,space?,options?):string|undefined
Defined in: packages/core/src/json/json-stringify-safe.ts:32
Stringify a value to a JSON string, handling circular references, Error objects, and BigInt values gracefully.
Parameters
Section titled “Parameters”unknown
The value to stringify.
replacer?
Section titled “replacer?”A function that alters the behavior of the stringification process, or an array of String and Number objects that serve as a whitelist for selecting/filtering the properties of the value object to be included in the JSON string. If this value is null or not provided, all properties of the object are included in the resulting JSON string.
space?
Section titled “space?”string | number
The number of spaces to use for indentation or a string to use as whitespace.
options?
Section titled “options?”JsonMakeAllReplacersFunctionOptions
Options to customize the behavior of the stringification, such as handling circular references.
Returns
Section titled “Returns”string | undefined
A JSON string representation of the value, or undefined if the value cannot be stringified.