JSON Formatter
Format, validate, and minify JSON. Instant error detection with line numbers.
Navigation
Private by default
Files stay in your browser. Nothing is uploaded unless a tool says otherwise.
When to use this
You just hit an API endpoint and the response came back as a single wall of text — thousands of characters with no whitespace. You need to find one nested field three levels deep, but scrolling through minified JSON is like reading a novel with no paragraphs. Paste it here and the structure appears instantly with proper indentation.
Same story when you're debugging a webhook payload, inspecting a JWT body (decode the middle segment with Base64 first, then format the JSON here), or trying to make sense of a massive config file someone committed without formatting. If the JSON is broken, you'll get the exact line and character position of the error instead of a cryptic "Unexpected token" from your browser console.
The minify direction is just as useful. You need to shove JSON into an environment variable, a URL parameter, or a single-line config field — compacting it down removes all whitespace while keeping the data intact.
Good to know
JSON is not JavaScript. Despite the name, JSON is a strict subset. Trailing commas are illegal. Keys must be double-quoted strings. No comments allowed. Single quotes don't work. If you're used to writing JS objects, these are the rules that trip you up — and this validator catches all of them.
Indentation is a style choice, not a spec requirement. The JSON specification (RFC 8259) says nothing about whitespace formatting. Two spaces, four spaces, tabs — all produce identical data. This tool defaults to 2-space indentation because it's the most common convention in web development, but the minified output is what actually gets sent over the wire.
Large JSON files can crash browser dev tools. Chrome's console pretty-printer chokes on responses above ~5MB. Pasting into a dedicated formatter is often faster and more reliable for big payloads since it doesn't carry the overhead of the entire DevTools environment.
Power user tip: JSON5 isn't JSON. If you're getting validation errors on a file that "looks right," check whether it uses JSON5 extensions (comments, trailing commas, unquoted keys). Many config tools — including VS Code's settings.json — actually use JSON5 or JSONC under the hood, which won't validate as strict JSON per RFC 8259.
Quick Reference
| Common JSON Error | What It Means | Fix |
|---|---|---|
| Unexpected token at position N | Invalid character at byte N | Check for trailing commas or missing quotes near that position |
| Unterminated string | A string value was never closed | Look for a missing closing double quote |
| Expected ':' after key | Object key without a value | Add a colon and value after the key |
| Unexpected end of input | JSON is incomplete | Check for missing closing } or ] |
| Duplicate key | Same key appears twice in one object | RFC 8259 says keys SHOULD be unique — rename or remove the duplicate |