About the JSON Formatter
The JSON Formatter checks your JSON as you type and rewrites it in place, either pretty-printed with spaces or tabs or minified onto one line, optionally with keys sorted. If the JSON cannot be parsed, the error is shown with its line and column so you can track down the problem.
How it works
When you click Beautify or Minify, the text is parsed with the browser's built-in JSON parser and then serialized again. Beautify uses the indentation selected in the Indent menu; Minify uses none. The formatted result replaces the text in the editor, so you can keep editing it.
Because the JSON is fully parsed and rebuilt, the output is always valid, consistently spaced JSON. Key order is preserved, but if an object has duplicate keys only the last value is kept, and very large integers beyond 2^53 lose precision, as they do in any JavaScript-based tool.
How to use
- 1
Paste your JSON into the editor.
- 2
Choose 2 spaces, 4 spaces or Tab, and tick Sort keys A–Z if you want keys in order.
- 3
Click Beautify to pretty-print, or Minify to compress.
- 4
If an error appears, fix the problem at the reported line and column; the status updates as you type.
- 5
Click Copy JSON or Download to save the result.
Worked examples
Beautify
A compact API response.
Minify
Compressing a formatted config.
Invalid JSON
A trailing comma.
Frequently asked questions
What is the benefit of minifying JSON?+
It removes whitespace, making the payload smaller for network transfer and letting it fit on one line.
Will this catch syntax errors in my JSON?+
Yes. If parsing fails, the parser's error message is shown in place of the valid status, often with a position that points to the problem.
Does it change my data?+
Values stay the same, and key order too unless you tick Sort keys. Only whitespace changes, except that duplicate keys are reduced to the last one and very large integers may lose precision.
Can it format JSON with comments?+
No. Comments are not valid JSON, so remove them before formatting.
Can I indent with tabs?+
Yes. Pick Tab in the Indent options before clicking Beautify.