JSON Formatter
Format, validate and minify JSON — with errors that point at the line.
Start typing above and the result appears here.
How to use JSON Formatter
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.
Why use this json formatter
Runs on your device
Your input is handled entirely in this browser tab. Nothing is uploaded, so there is nothing for us to store, log or leak.
No sign-up, no quota
No account, no daily limit, no watermark and no email wall. Use it once or two hundred times a day.
Built to be linked
Options are stored in the URL, so a configured tool is a link you can send to a colleague or bookmark.
Technical notes
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.
The errors this tool explains rather than reports
| Mistake | Raw engine message | What you get here |
|---|---|---|
| Trailing comma | Unexpected token } | Line 4, column 22 — trailing comma before this bracket |
| Single quotes | Unexpected token ' | Line 2, column 11 — JSON strings need double quotes |
| Unquoted key | Unexpected token n | Line 3, column 3 — property names must be quoted |
| Truncated file | Unexpected end of JSON input | A bracket was opened and never closed |
Supported
- RFC 8259 JSON, validated by the browser's own parser
- Two, four and tab indentation
- Recursive key sorting at every nesting level
- Structure read-out: depth, key count, array and object counts
- Measured minification saving on your own input
Limits and trade-offs
- 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.
Last verified August 2026 · benchmarks re-run each quarter.
Frequently asked questions
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.