JSON formatted output
- 2020-03-30 04:16:32
- OfStack
One requirement today is to format the output JSON
The first thing that comes to mind is a widget like jsBeautifier
After a bit of searching, a friend replied that json.stringify could output a formatted JSON string
JSON.stringify(jsObj, null, "t"); //Indent a TAB
JSON.stringify(jsObj, null, 4); //Indent 4 Spaces
Well, good
PS: about json operation, here again for you to recommend a few more practical json online tools for your reference:
Online JSON code verification, verification, beautification, formatting tools:
(link: http://tools.jb51.net/code/json)
JSON online formatting tool:
(link: http://tools.jb51.net/code/jsonformat)
Online XML/JSON interconversion tool:
(link: http://tools.jb51.net/code/xmljson)
Json code online formatting/beautification/compression/editing/conversion tools:
(link: http://tools.jb51.net/code/jsoncodeformat)
Online json compression/escape tool:
(link: http://tools.jb51.net/code/json_yasuo_trans)
C language style /HTML/CSS/json code format beautification tool:
(link: http://tools.jb51.net/code/ccode_html_css_json)