beautify json in js code example
Example 1: JSON.stringify pretty
var str = JSON.stringify(obj, null, 2); // spacing level = 2
Example 2: js json stringfy beutify
JSON.stringify(obj, undefined, 2);
var str = JSON.stringify(obj, null, 2); // spacing level = 2
JSON.stringify(obj, undefined, 2);