What it does
The JSON Formatter turns hard-to-read JSON into neatly indented, colour-highlighted text — also called pretty printing or beautifying — or squeezes it back into a single compact line. It also checks that the JSON is valid while it works, so a missing comma or quote is reported straight away instead of failing later in your code.
It understands a few awkward cases that trip up other formatters:
- Escaped (stringified) JSON, such as
"{\"id\":1}"copied out of a log or a database column, is unescaped and formatted. - Several JSON values in a row, such as log lines or NDJSON, are formatted one by one.
- Broken JSON is repaired, not rejected. Missing or extra brackets, a cut-off end, trailing commas, single quotes, unquoted keys, comments, Python
None/Trueand timestamps or log text around the JSON are fixed automatically. The status bar lists what was fixed, and Auto-fix writes the repaired JSON back into the editor.
How to use it
- Paste your JSON into the Input pane, or open a file.
- Choose Beautify to indent it, Minify to remove all spaces, or Stringify to turn it into an escaped string literal you can paste into code.
- Pick the indentation (2 spaces, 4 spaces or Tab) and tick Sort keys if you want object keys in alphabetical order.
- Copy the result or download it.
Pasting never changes anything on its own; the result appears when you choose an action.
Example
{"id":42,"name":"Ada","roles":["admin","dev"],"active":true}
With Beautify and 2 spaces this becomes:
{
"id": 42,
"name": "Ada",
"roles": [
"admin",
"dev"
],
"active": true
}
Good to know
- Minify on several values gives one value per line, which is the NDJSON / JSON Lines format many log tools expect.
- Sort keys sorts nested objects too, which makes two JSON files much easier to compare in the Diff Finder.
- Very large files are formatted but shown without colours above a size limit, so the page stays responsive.
FAQ
I pasted part of a log and the brackets don't match. Will it still work? Yes. The formatter cuts the JSON out of the log, closes brackets that were never closed and drops extra ones, then tells you what it changed, for example Auto-fixed: removed text around the JSON, closed 2 brackets. Check the result if the original was cut off, because missing values cannot be guessed.
How do I find out exactly what was wrong? The JSON Validator shows the exact line and column of the first problem with a hint for the fix.
Can I convert the formatted JSON to YAML, XML or code? Yes: use the JSON to YAML converter, the Data Format Converter or JSON to Code for TypeScript, C#, Java and more.
Is my JSON sent anywhere? No. Formatting happens in your browser tab.
Is this the same as a JSON pretty printer or a JSON linter? Yes. "Pretty print", "beautify" and "format" all mean re-indenting JSON so people can read it, and a linter checks the syntax. This tool does both: it re-indents your JSON and reports the first syntax problem as it works. The JSON Validator shows the exact line and column with a fix hint if you want more detail.
Does it work offline? Yes. Everything runs in your browser tab: no account, no server, nothing uploaded. Once the page has loaded you can disconnect from the internet and keep formatting.