Guides
Format, read and fix JSON in the tools you already use.
- 01Can JSON have comments?No. Standard JSON has no comment syntax, so // and /* */ break JSON.parse. See why, when JSONC or JSON5 work, and how to strip comments safely.
- 02How to format JSON in Notepad++Format JSON in Notepad++ with the JSON Viewer plugin: install it from Plugins Admin and press Ctrl+Alt+Shift+M. Also JSTool, JSON Tools, and a no-plugin method.
- 03How to format JSON in VS CodeFormat JSON in VS Code with Shift+Alt+F on Windows, Shift+Option+F on Mac or Ctrl+Shift+I on Linux. Set format on save and fix a formatter that does nothing.
- 04Pretty print JSON in JavaScriptPretty print JSON in JavaScript with JSON.stringify(data, null, 2): tabs, replacers, sorted keys, Node one-liners, the console, HTML pre and [object Object].
- 05Pretty print JSON on the command linePretty print JSON in a terminal with jq, python -m json.tool, Node or PowerShell on Linux, macOS and Windows. Pipe curl into jq and decode a JWT payload.
- 06Pretty print JSON in PythonPretty print JSON in Python with json.dumps(data, indent=4), sort keys, keep accents with ensure_ascii=False, write files, or run python -m json.tool.