Skip to main content

JSON.stringify()[JSON](json_object) [API](api) [Static Method](static-method) to convert data to JSON string

(method) JSON.stringify(data, replacer?, space?): string

replacer

optional parameter to provide array of properties OR value visitor

value visitor

function to transform data before stringify type ValueVisitor = (key: string, value: any) => any

!snippet JSON.stringify({a: ["b", "c"]})

"{"a":["b","c"]}"

JSON.stringify(123n)

TypeError: BigInt value can't be serialized in JSON

References