CFXIXI工作室首页
CF西西的博客 | 如何格式化JSON生成漂亮的格式

如何格式化JSON生成漂亮的格式

7. 七月 2015

转自:http://stackoverflow.com/questions/2614862/how-can-i-beautify-json-programmatically

The JSON.stringify method supported by many modern browsers (including IE8) can output a beautified JSON string:

JSON.stringify(jsObj,null,"\t");// stringify with tabs inserted at each level
JSON.stringify(jsObj,null,4);// stringify with 4 spaces at each level

javascript