JSON troubleshooting

Common JSON Errors and How to Fix Them

Published August 23, 2026

Learn how to find and fix common JSON errors, including missing commas, quote problems, trailing commas, and mismatched brackets.

Why JSON errors happen

JSON is strict by design. A single missing quote, comma, or closing bracket can make the entire document invalid. When an API response or configuration file fails to parse, start with the line and character reported by your validator, then inspect the nearby punctuation.

Paste a non-sensitive sample into the JSON Beautifierto format valid data and make its structure easier to inspect.

1. Missing or extra commas

Object properties and array items need commas between them. The last item does not need one. A missing comma often produces an error on the next property, which can make the message seem misleading.

{
  "name": "Ada"
  "role": "editor"
}

Add a comma after the first property:

{
  "name": "Ada",
  "role": "editor"
}

2. Single quotes instead of double quotes

Standard JSON requires double quotes around property names and text values. Single quotes may work in JavaScript source, but they are not valid JSON syntax.

{'name': 'Ada'}

Replace both kinds of quotes with double quotes:

{"name": "Ada"}

3. Trailing commas

JSON does not allow a comma after the final property or array item. Remove it before the closing brace or bracket.

{
  "name": "Ada",
}

4. Mismatched brackets and braces

Every opening brace, bracket, or quote must have a matching closing character. Check nested objects from the inside out and make sure objects use curly braces while arrays use square brackets.

{
  "roles": ["admin", "editor"
}

The array needs its closing bracket before the object closes:

{
  "roles": ["admin", "editor"]
}

5. Invalid values and comments

JSON values are limited to strings, numbers, objects, arrays,true, false, and null. JSON also does not support comments, undefined, NaN, or unquoted words. Remove comments and convert JavaScript-only values before parsing.

{
  "enabled": True,
  // temporary setting
  "value": undefined
}

A quick process for fixing JSON errors

  1. Read the validator message and note its line and column.
  2. Inspect the punctuation immediately before and after that location.
  3. Check quotes, commas, brackets, and allowed value types.
  4. Format the corrected document and validate it again.

Avoid making several unrelated edits at once. Fixing one syntax error at a time makes the next parser message much easier to trust.