js json pretty print code example
Example 1: js json_encode pretty
var str = JSON.stringify(obj, null, 2); // spacing level = 2
Example 2: pretty print json in console
new JSONObject(json).toString(2)
var str = JSON.stringify(obj, null, 2); // spacing level = 2
new JSONObject(json).toString(2)