JSON Formatter
Paste messy or minified JSON to format, minify, or explore it as a collapsible tree. Runs entirely in your browser, nothing is sent anywhere.
Formatted output will appear here.
How to use this
Paste any JSON into the box on the left, then choose whether you want it formatted with clean indentation, minified down to a single line, or explored as a collapsible tree so you can drill into nested objects and arrays without scrolling through a wall of text. If something's wrong with your JSON, this tool tells you exactly which line and column to check instead of failing silently.
The errors this catches most often
Almost every broken JSON file fails for one of five reasons, and the validator above points at the exact position of the problem:
- A trailing comma after the last item in an object or array. JSON does not allow it, even though JavaScript does.
- Single quotes around keys or values. JSON strings must use double quotes.
- Unquoted keys. Every key in a JSON object has to be a quoted string.
- Comments. Strict JSON has no comment syntax; a // note line breaks the parse.
- A missing or extra bracket, usually a } closing an array or a comma forgotten between two items.
Fix them top-down: parsers report the first place the structure stops making sense, which is often one line after the real mistake, so check the line above the reported position as well.
Format, minify or validate: which do you need?
Format when you have to read the data: an API response, a config file or a log line that arrived as one dense string. Two-space indentation is the common convention; use four if your team or the file itself already does.
Minify when the JSON is about to be stored or sent and nobody will read it: removing whitespace typically shrinks a payload by 15 to 30 percent without changing the data at all.
Validate when something downstream is rejecting your file or an API returns a parse error. Validation changes nothing; it just tells you whether the text is legal JSON and, if not, where it breaks. The tree view is the fastest way to explore a large response whose shape you do not know yet.
Frequently asked questions
What is the difference between formatting and validating JSON?
Validation only checks whether the text follows the JSON rules and reports the position of the first error. Formatting assumes the JSON is valid and rewrites it with clean indentation so a person can read it.
Why does JSON reject comments and trailing commas?
The JSON specification deliberately keeps the format minimal: no comments, no trailing commas, double quotes only. Dialects such as JSON5 and JSONC allow them, but standard parsers, including browsers and most APIs, will refuse a file that uses them.
How do I format JSON with this tool?
Paste your JSON into the box, then choose to format it with clean indentation, minify it to a single line, or explore it as a collapsible tree.
Does it tell me where my JSON is wrong?
Yes. If the JSON is invalid, the tool shows the exact line and column of the problem instead of failing silently.
Is my JSON uploaded to a server?
No. The formatter runs entirely in your browser, so your data stays on your device.
What are the most common reasons JSON is invalid?
A trailing comma after the last item, single quotes instead of double quotes, and comments (which JSON does not allow) cause most errors.