JS: JSON.stringify
JSON.stringify(obj)
-
Convert a JavaScript object to JSON string format.
const xx = { a: 3, b: [4, 2] } console.log(JSON.stringify(xx) === `{"a":3,"b":[4,2]}`) const yy = [1, 2, [3, 4, [5, 6]]] console.log(JSON.stringify(yy)=== `[1,2,[3,4,[5,6]]]`)