json stringify pretty

JavaScript
JSON.stringify(jsonobj,null,'\t')var str = JSON.stringify(obj, null, 2); // spacing level = 2var person={"first_name":"Tony","last_name":"Hawk","age":31};
var personJSONString=JSON.stringify(person); new JSONObject(json).toString(2) JSON.stringify(obj, undefined, 2);
Source

Also in JavaScript: