$ json --format
json formatter / validator.
Format, validate, and beautify JSON with syntax highlighting. 100% client-side.
input
1
2
3
4
5
2
3
4
5
0 / ∞ chars
output
Common causes: trailing commas, single quotes instead of double quotes, unquoted keys, or comments (JSON does not support comments).
Validation checks if JSON syntax is correct. Formatting beautifies valid JSON with proper indentation. The tool does both in one click.
Click the "Minify" button. This removes all whitespace, reducing file size for faster API transfers.
Top JSON Syntax Errors
| Mistake | Wrong | Correct |
|---|---|---|
| Trailing comma | {"a": 1,} | {"a": 1} |
| Unquoted keys | {a: 1} | {"a": 1} |
| Single quotes | {'a': '1'} | {"a": "1"} |
| Comments | // comment | Not allowed in JSON |
| Unquoted strings | {"a": hello} | {"a": "hello"} |
JSON vs JSON5 vs JSONC
// JSON (strict) — no comments, no trailing commas
{"name": "app", "version": "1.0"}
// JSON5 (relaxed) — comments allowed, trailing commas OK
{
name: "app", // this is fine
version: "1.0",
}
// JSONC (VS Code) — JSON with comments
{
// Configuration file
"name": "app"
}
Debugging tip: When JSON.parse() throws an error, the message includes the character position. Count characters from the start of the string to find the exact problem location.
learn more in our detailed guide.
→ read the guide