Working with json objects and json files
Table of Contents
How to prettify json content?
I have a JSON file with a single long line. How can we indent this?
{"menu": {"id": "file", "value": "File", "popup": {"menuitem": [{"value": "New", "onclick": "CreateNewDoc()"}, {"value": "Open", "onclick": "OpenDoc()"}, {"value": "Close", "onclick": "CloseDoc()"}]}}}
- In emacs, select the text and do
M-x json-pretty-print
- If the file is a json file, we can use
M-x json-pretty-print-buffer