APIs return JSON minified into a single dense line, which is efficient for machines and miserable for humans. Formatting — also called beautifying or pretty-printing — adds indentation and line breaks so you can actually read the structure, find a key, or spot why a payload fails to parse. Here is how to format JSON in seconds, plus the syntax errors that trip people up most often.
Format JSON in your browser
- Open the free JSON formatter.
- Paste your minified or messy JSON into the input box.
- The tool validates and reformats it instantly, with clean indentation.
- Copy the formatted result, or toggle minify to compress it again for production use.
Everything runs locally in your browser, so API responses containing keys or personal data never leave your device. If the input is invalid, the formatter tells you exactly where the syntax breaks instead of silently failing.
The 5 most common JSON errors
When JSON refuses to parse, it is almost always one of these:
- Trailing commas.
{"a": 1,}is invalid — remove the comma after the last item. JavaScript objects allow this; JSON does not. - Single-quoted strings.
{'key': 'value'}is invalid — JSON requires double quotes around all strings and keys. - Unquoted keys.
{key: "value"}is invalid — every key must be a double-quoted string. - Comments.
//and/* */are not part of the JSON spec. Strip them before parsing, or use JSON5 if your tooling supports it. - Mismatched brackets. A missing
}or]deep in a nested structure. A validator that reports the line number saves you from counting brackets by hand.
Validate before you ship
Formatting makes JSON readable, but it does not guarantee it is valid. After editing a payload, run it through a JSON validator to confirm it parses cleanly — especially before pasting it into a config file, an API request body, or a database import. Catching a trailing comma in the browser beats debugging a failed deploy.
Working with other formats
When an API speaks XML instead of JSON, convert between the two with the JSON to XML converter rather than rewriting structures by hand. And if you are starting from a spreadsheet or a pasted table, the CSV-to-JSON direction is covered too — format first, then validate, then convert.
Frequently asked questions
What does it mean to format or beautify JSON?
Formatting adds consistent indentation and line breaks to compact or minified JSON without changing the data. It makes the structure readable so you can find keys, spot errors, and compare values.
Why won't my JSON parse even though it looks correct?
The usual culprits are trailing commas, single-quoted strings, unquoted keys, comments, or a missing closing bracket. Run the JSON through a validator to get the exact line and character of the error.
Is it safe to paste JSON into an online formatter?
It is safe when the tool runs entirely in your browser, because your data never leaves your device. Avoid paste-it-and-upload formatters for JSON containing API keys, tokens, or personal data.