How to use the JSON Formatter
Last verified 2026-08-08 · about 6 minutes to read
The short version
- 1.Paste your JSON. It is parsed as you type. Nothing is uploaded, so pasting a production payload is safe.
- 2.Read the error, if there is one. Invalid JSON shows the line, column, the offending text and the most likely cause.
- 3.Beautify or minify. Beautify for reading, minify for shipping. The size saving is shown alongside the result.
Why this is worth getting right
When JSON fails to parse, most online formatters print the browser's raw message: "Unexpected token } in JSON at position 847". This tool resolves that byte offset to a line and column, quotes the offending line, points a caret at the character, and names the likely cause from the six mistakes that account for nearly all invalid JSON.
Method 1 — use the JSON Formatter on this site
The fastest route. It runs entirely in your browser, so nothing is uploaded and there is no queue to wait in. No account is needed and there is no daily limit.
- Paste your JSON. It is parsed as you type. Nothing is uploaded, so pasting a production payload is safe.
- Read the error, if there is one. Invalid JSON shows the line, column, the offending text and the most likely cause.
- Beautify or minify. Beautify for reading, minify for shipping. The size saving is shown alongside the result.
Method 2 — do it without this site
Worth knowing, because a tool you cannot replace is a dependency rather than a convenience. Most tasks in the developer division have a command-line or built-in equivalent; it is usually more setup and less convenient, but it works offline and it is scriptable, which matters once you are doing something a hundred times instead of once.
What this tool will not do
Every tool has an edge. These are ours for json formatter, stated up front so you find out here rather than halfway through a deadline:
- Strict JSON only — no comments, trailing commas or unquoted keys.
- Numbers round-trip through JavaScript, so integers beyond 2^53 lose precision. Keep those as strings.
- Key order is preserved unless you sort, but duplicate keys collapse to the last one, as the specification requires.
Questions people ask
Why does my JSON say "Unexpected token" when it looks correct?
The three usual causes are a trailing comma before a closing bracket, single quotes instead of double quotes, and unquoted property names. All three are valid JavaScript and none of them are valid JSON. This tool names which one it found.
Is my JSON sent to a server?
No. Parsing and formatting run in your browser using the built-in JSON parser. API responses routinely contain tokens, customer records and internal identifiers, which is exactly why this tool has no server to send them to.
What does sorting keys do?
It orders every object's keys alphabetically, at every level of nesting. JSON objects have no defined order, so two dumps of identical data can differ only in key order. Sorting both makes them comparable in a diff.
Does it support JSON5, JSONC or comments?
No. This validates against the JSON specification, so comments, trailing commas and unquoted keys are all reported as errors. That is the point — if it parses here it will parse in your language's standard library.
How large a file can it handle?
Around 10 MB comfortably. Above that the browser's own JSON.parse becomes the constraint, not this tool, and the result is likely to be too large to read on screen anyway.
Why is my minified output larger than expected?
Minifying only removes whitespace. If the input was already compact, the saving is near zero. The percentage shown next to the result is measured on your actual input, not estimated.