How to use the JSON Formatter & Validator
- Paste your JSON.
- Click Format to beautify it, Minify to compress it or Sort keys to order them A to Z.
- If there is an error, the message shows the line and column so you can fix it.
- Copy or download the result.
Worked examples
| Problem | Invalid | Valid |
|---|---|---|
| Single quotes | {'a': 1} | {"a": 1} |
| Trailing comma | [1, 2, ] | [1, 2] |
| Unquoted key | {a: 1} | {"a": 1} |
| Comment | {"a": 1 // note} | {"a": 1} |
Frequently asked questions
Is my JSON sent to a server?
No. Formatting and validation run in your browser using JSON.parse, so private data stays on your device.
Why does my JSON say "Unexpected token"?
Common causes are single quotes, trailing commas, comments or a missing quote or bracket. The error shows the position.
What is the difference between format and minify?
Format adds line breaks and indentation for reading. Minify removes all extra whitespace to make the file smaller.
Can it handle large files?
Yes, several megabytes are fine in a modern browser.
How do I encode JSON for a URL?
Minify it, then use the URL Encoder / Decoder or Base64 Encoder / Decoder.