JSON Formatter & Validator
Paste JSON to pretty-print it, validate it, or minify it. Invalid JSON shows a clear error instead of a blank result.
How to use the JSON Formatter & Validator
- Paste your JSON into the box.
- Click "Format" to pretty-print it with indentation, or "Minify" to compact it to one line.
- If the JSON is invalid, the exact error and where it occurred is shown instead.
How it works
Formatting re-parses your JSON with JSON.parse() and re-serializes it with consistent 2-space indentation — the same approach used by browser dev tools. For example, {"a":1,"b":[2,3]} becomes a readable multi-line block. If parsing fails — a trailing comma, an unquoted key, a missing bracket — you get the exact error JavaScript's own parser reports, including the character position, rather than a generic "invalid JSON" message.
Frequently asked questions
Is my JSON uploaded anywhere?
No — parsing and formatting happen with your browser's built-in JSON.parse()/JSON.stringify(), entirely on your device.
Why does it say my JSON is invalid when it looks fine?
Common causes: trailing commas after the last item, single quotes instead of double quotes, or an unquoted object key — all valid in JavaScript object literals, but not in strict JSON.