JSON Formatter & Validator
Paste your JSON — format, validate, minify, or download it instantly.
Raw or minified JSON is nearly impossible to read. This formatter parses your JSON, validates it for syntax errors, and outputs clean, indented, human-readable code — the same formatting your IDE provides, but accessible from any browser. It handles nested objects, large arrays, and edge cases like Unicode strings and special characters.
How to Format JSON Online
- Paste your JSON — copy raw, minified, or malformed JSON into the input box.
- Click "Format / Pretty Print" — the JSON is instantly beautified with 2-space indentation and proper line breaks.
- Check for errors — if the JSON is invalid, you'll see a clear error message. Fix the issue and try again.
- Optionally minify — click "Minify" to remove all whitespace and compress the JSON for use in production.
- Copy or download — use the Copy button or download the formatted JSON as a .json file.
The 7 JSON Errors That Break Everything
JSON looks like JavaScript but is far stricter. These are the errors behind virtually every "Unexpected token" message:
| Error | Broken | Valid |
|---|---|---|
| Trailing comma | {"a": 1,} | {"a": 1} |
| Single quotes | {'a': 1} | {"a": 1} |
| Unquoted key | {a: 1} | {"a": 1} |
| Comments | {"a": 1} // note | JSON has no comments — remove them |
undefined / NaN | {"a": undefined} | {"a": null} |
| Unescaped quote in string | {"msg": "say "hi""} | {"msg": "say \"hi\""} |
| Leading zeros | {"n": 007} | {"n": 7} |
Paste failing JSON above — the validator pinpoints the exact line and character. If your data comes from JavaScript code (single quotes, comments), it is JavaScript object notation, not JSON: run it through JSON.stringify at the source rather than hand-fixing.
Frequently Asked Questions
jq or python -m json.tool.📖 Further reading: Best Free Tools for Developers