JSON Stringify Ouput to Multiple Lines
you can also use.
var json = JSON.stringify({ uno: 1, dos : {"s":"dd","t":"tt"} }, null, '\t');
console.log(json);
Or even better, the count of spaces in the indentation:
var json = JSON.stringify({ uno: 1, dos : {"s":"dd","t":"tt"} }, null, 2);
You can use the space
parameter of the stringify method. From the official page, here is the relevant excerpt:
JSON.stringify({ a: 2 }, null, " "); // '{\n "a": 2\n}'