Standard built-ins
JSON.stringify()
Serialize supported data into JSON text; omit certain object values, replace unsupported array entries with null, reject cycles and ordinary BigInt. Root unsupported values may return undefined.
Formal Syntax & Structure
javascript syntaxjavascript
JSON.stringify(value, [replacer], [space])Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| value | Any | Value to associate or insert. |
| replacer | Function | Array | null | Optional transform or property names. |
| space | Number | String | Optional indentation. |
Return Value
String | undefined
JSON text or undefined.
Working Example
Example Snippetjavascript
console.log(JSON.stringify({n:3}));