Why JSON errors are so frustrating

JSON looks simple. It's just brackets, quotes, and commas — how hard can it be? But that simplicity is exactly why JSON errors are so annoying. A single misplaced character makes the entire document unparseable, and the error message you get back is often vague or points to the wrong line.

If you're hand-writing JSON or pasting it from somewhere else, the same five mistakes come up again and again. The good news: once you know what to look for, you can spot and fix them in seconds.

The fastest way to find JSON errors

Paste your JSON into the JSON Formatter. It validates the syntax and highlights the exact spot where parsing fails — no guessing required.

1 Trailing commas

This is the most common JSON error by far. In JavaScript, you can leave a comma after the last item in an object or array. In JSON, you cannot.

❌ Invalid JSON
{
  "name": "Alice",
  "age": 30,
}
✅ Valid JSON
{
  "name": "Alice",
  "age": 30
}

The fix is simple: delete the comma that comes immediately before a closing brace } or closing bracket ]. If you're generating JSON by hand, do a quick scan of the file for any , that's followed (after whitespace) by } or ].

2 Unquoted keys

JavaScript lets you write object keys without quotes. JSON does not. Every key must be a double-quoted string.

❌ Invalid JSON
{
  name: "Alice",
  age: 30
}
✅ Valid JSON
{
  "name": "Alice",
  "age": 30
}

This mistake is especially common when someone copies a JavaScript object literal and assumes it's valid JSON. It isn't. If your JSON parser is complaining about an "unexpected token" near the start of a key, this is almost certainly the cause.

3 Single quotes

JSON only accepts double quotes — for both keys and string values. Single quotes are not valid, and neither are backticks.

❌ Invalid JSON
{
  'name': 'Alice',
  "age": 30
}
✅ Valid JSON
{
  "name": "Alice",
  "age": 30
}

The fix is a straight find-and-replace: swap every ' for ". Just watch out for apostrophes inside string values — those should stay as-is, since they're part of the text, not the syntax.

4 Missing commas

Every key-value pair in an object, and every element in an array, must be separated by a comma — except the last one. Forget one, and the parser will throw an error on the line that follows.

❌ Invalid JSON
{
  "name": "Alice"
  "age": 30
}
✅ Valid JSON
{
  "name": "Alice",
  "age": 30
}

The confusing part is that the error usually points to the next line, not the line with the missing comma. If you get an error like "expected ',' or '}' after property value", scan the line above for a missing comma.

5 Comments in JSON

JSON has no comment syntax. You can't use // or /* */ — both will break parsing.

❌ Invalid JSON
{
  // user's display name
  "name": "Alice",
  "age": 30
}
✅ Valid JSON
{
  "name": "Alice",
  "age": 30
}

If you need comments for a config file, use a format that supports them — JSONC, YAML, or TOML. But if the data has to be parsed by a strict JSON parser, strip the comments out first.

JSON Validator
Find the exact line and character where JSON parsing fails

The JSON debugging checklist

When JSON won't parse, work through this list in order. It catches the vast majority of issues.

  1. Remove trailing commas. Look for , immediately before } or ].
  2. Quote every key. All object keys must be wrapped in ".
  3. Swap single quotes for double. Only " is valid in JSON.
  4. Check for missing commas. Every item except the last needs one.
  5. Strip comments. No // or /* */ allowed.
  6. Validate with a tool. Use the JSON Validator to confirm the fix.

Once your JSON is valid, run it through the JSON Formatter to make it readable. It indents everything correctly and highlights the structure so you can spot issues at a glance. If you're shipping JSON to production, the JSON Minifier strips the whitespace back out.

Pro tip: format before you debug

If your JSON is one long unformatted line, formatting it first makes every error easier to spot. Indentation reveals missing commas and trailing commas instantly — because they end up at the start or end of a visible line instead of being buried in the middle.

Frequently asked questions

What is the most common JSON mistake?
The most common JSON mistake is a trailing comma — a comma left after the last item in an object or array. JSON doesn't allow trailing commas, unlike JavaScript.
Can JSON use single quotes?
No. JSON only accepts double quotes for both keys and string values. Single quotes are not valid JSON syntax.
Do JSON keys need quotes?
Yes. Every property key in a JSON object must be wrapped in double quotes. Unquoted keys are valid in JavaScript but not in JSON.
Can I use comments in JSON?
No. The JSON specification does not support comments. If you need comments, use JSONC (JSON with Comments) or a different format, then strip them before parsing.
How do I validate my JSON?
Paste your JSON into the JSON Validator. It checks syntax and points to the exact line and character where the error occurs.