Why JSON errors are frustrating
A single misplaced comma or a trailing comma after the last array element causes the entire JSON to fail parsing. The error message — "Unexpected token }" or "SyntaxError: JSON Parse error" — often points to the wrong line because the parser only discovers the error when it hits an unexpected character, not where the actual mistake was.
A proper JSON formatter parses the input and highlights exactly where the error is, making debugging fast.
How to format JSON in seconds
- Open the free JSON formatter
- Paste your JSON string
- Click Format — valid JSON is pretty-printed with 2-space indentation and syntax highlighting
- If invalid, the error message shows the exact position of the problem
No account required. All processing happens in your browser — API responses, database exports, and configuration files containing sensitive data are never uploaded anywhere.
The three errors that cause 80% of JSON failures
1. Trailing commas
This is valid in JavaScript objects and in languages like Python (trailing commas in tuples and lists are allowed). It is not valid in JSON:
{
"name": "Alice",
"age": 30, ← trailing comma after last property
}The comma after 30 is illegal. Remove it.
2. Single quotes instead of double quotes
JSON requires double quotes around all strings — keys and values. Single quotes are not valid JSON, even though they work in JavaScript:
{ 'name': 'Alice' } ← invalid JSON{ "name": "Alice" } ← valid JSON3. Comments
JSON does not support comments. This is valid JavaScript but invalid JSON:
{
// user data
"name": "Alice"
}If you have JSON with comments (sometimes called JSONC — used in VS Code config files), strip the comments before parsing standard JSON.
Minifying JSON for production
The same formatter also minifies JSON — removing all whitespace to produce the most compact representation. This is useful for:
- Reducing API response payload size
- Embedding JSON in HTML without wasted space
- Comparing two JSON strings for equality (minified strings can be compared directly)
Validating JSON without formatting
If you just need to know whether a string is valid JSON without reformatting it, the formatter shows a validation result at the top: "Valid JSON" or the specific error with position. This is useful for quick validation of API responses without needing to read the formatted output.
JSON vs JavaScript object notation
A common source of confusion: JavaScript object notation and JSON look almost identical but are not the same format. JSON is a strict subset:
- JSON requires double quotes; JS allows single and backtick quotes
- JSON doesn't allow trailing commas; JS does
- JSON doesn't allow comments; JS does
- JSON doesn't allow undefined, NaN, or Infinity as values; JS does
- JSON keys must be quoted; JS allows unquoted identifiers
Summary
Format and validate JSON with the free JSON formatter — no account, no upload. The three most common errors are trailing commas, single quotes, and comments — all invalid in JSON. Use the minifier to compress JSON for production payloads.