使用空格进行字符串化
var JSONObject = {
stringProp: 'stringProp',
booleanProp: false,
intProp: 8
}
var JSONString = JSON.stringify(JSONObject, null, 2);
console.log(JSONString);
/* output:
* {
* "stringProp": "stringProp",
* "booleanProp": false,
* "intProp": 8
* }
*/