JavaScript: JSON.stringify

By Xah Lee. Date: . Last updated: .

JSON.stringify( obj)

Convert a JavaScript object to JSON string format.

console.log(
 JSON.stringify ( {a:3 , b:[4,2]})
);
// prints
// {"a":3,"b":[4,2]}

JSON.stringify takes optional 2nd and 3rd args. For detail, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify

JS in Depth
XAH  BUY NOW

JS in Depth

JS Obj Ref

DOM


JS Obj Ref

JSON