JSON Problems

How to Fix Invalid JSON: Common Errors and Fixes

Most invalid JSON fails for one of a handful of reasons. Fix them one at a time, validating after each change, because the parser stops at the first error and hides the ones after it.

Last updated: 2 November 2026

Open JSON Validator →

Step-by-step

  1. Paste the JSON into the JSON Validator and note the first error and its position.
  2. Check the characters around that position against the examples on this page.
  3. Make one fix and validate again.
  4. Repeat until the document is valid.
  5. Format the result with the JSON Formatter to confirm that it reads correctly.

Trailing commas

JSON does not allow a comma after the last item.

Invalid: {"name": "Ada", "role": "admin",}

Valid: {"name": "Ada", "role": "admin"}

Single quotes and unquoted keys

Strings and keys must use double quotes.

Invalid: {'name': 'Ada', role: 'admin'}

Valid: {"name": "Ada", "role": "admin"}

Comments and special values

JSON has no comment syntax, so remove // and /* */ comments. The values undefined, NaN and Infinity are also not valid. Use null, a string or a number instead.

Hidden problems from copying

Text copied from a web page or word processor can contain curly quotes such as “ and ”, which look like quotes but are not valid. Replace them with straight double quotes. Unescaped line breaks and quotes inside a string also break parsing. Write a line break as \n and a quote as \".

Truncated JSON

If a response was cut off, the closing brackets are missing. Request the data again, or check whether a size limit is cutting the output.

USE THE TOOL

Finish the task with DevUtilityKits

Use the relevant online utility, check the result, and continue with your development workflow.

Open JSON Validator →Open JSON Formatter →
FAQ

Frequently asked questions

Can a tool fix invalid JSON automatically?

Some tools guess at repairs, but a guess can change your data. It is safer to find the error with a validator and fix it yourself.

Why do I only see one error at a time?

A parser stops at the first syntax error. Fix it and validate again to see the next one.

Why is my JSON invalid when it looks correct?

Look for curly quotes, a trailing comma, a comment or an invisible character copied from another document.

How do I put a quote inside a JSON string?

Escape it with a backslash, for example \"hello\". Write a line break as \n.