Answers
我之前练手写了一个,不知道有没有用,看能给你提供思路不。 https://github.com/hjzheng/JSONFormatter
8158432
answered 9 years, 1 month ago
在 JSFIDDLE 上看效果
var json = '{"color_scheme":"Packages/Predawn/predawn.tmTheme","default_line_ending":"unix","findreplace_small":true,"font_face":"Source Code Pro","font_options":["no_bold","no_italic"],"font_size":11,"ignored_packages":["Markdown","Vintage"],"rulers":[80,100,120],"shift_tab_unindent":true,"show_encoding":true,"show_line_endings":true,"tab_size":4,"tabs_medium":true,"theme":"predawn.sublime-theme","translate_tabs_to_spaces":true,"typescript_plugin_tsc_version":"1.6.2","word_wrap":true}'
var result = JSON.stringify(JSON.parse(json), null, 4);
// 用 jQuery
$("<pre>").text(result).appendTo($("body"));
魔法G一喵喵
answered 9 years, 1 month ago