JSON syntax errors: the ones that actually break your app
A missing comma or a stray trailing comma can take down an entire config load. Here are the JSON mistakes that come up again and again.
JSON's syntax is simple by design — that's the whole appeal — but simple isn't the same as forgiving. Unlike JavaScript object literals, which JSON's syntax resembles, JSON has no tolerance for a handful of small mistakes that are easy to make by hand and easy to miss on a quick read.
The repeat offenders
- Trailing commas — a comma after the last item in an array or object. JavaScript tolerates this; strict JSON parsers reject it outright.
- Single quotes — JSON requires double quotes for strings and keys. Single quotes are a JavaScript-ism that doesn't carry over.
- Unquoted keys — {name: "value"} is valid JavaScript but invalid JSON; keys need quotes too: {"name": "value"}.
- Comments — JSON has no comment syntax at all, not // and not /* */. Config files that need comments usually aren't actually JSON under the hood (JSONC, YAML, or similar).
- A trailing comma or missing comma between array/object entries — the two mirror-image versions of the same mistake, both easy to introduce during a quick manual edit.
Why the error messages feel unhelpful
A JSON parser typically reports the exact character position where parsing failed, not where the actual mistake is. A missing comma between two array items shows up as an error on the item *after* the missing comma, not the line where the comma should have been — which sends a lot of people hunting in the wrong spot the first few times they hit it.
A faster way to debug it
Rather than scanning by eye, paste the JSON into a formatter/validator that highlights the exact failure point and pretty-prints the structure. Once it's reformatted with consistent indentation, mismatched brackets and missing commas tend to jump out visually in a way they don't in single-line or inconsistently formatted JSON.
Processa's JSON formatter validates as you paste, points to the exact line and character of a syntax error, and re-indents the output — useful for both catching mistakes and just making an ugly single-line API response readable.
More from the blog
Understanding JWTs: what's actually inside that token
JWTs look like gibberish but they're just three pieces of base64. Here's how to actually read one, and the security mistakes to avoid.
DevRegex patterns every developer ends up needing
You don't need to memorize regex. You need to recognize the handful of patterns that cover 90% of real use cases.
Get new posts by email
We write practical guides on file processing, developer tools and product updates.
No spam. Unsubscribe any time.