0 uploads

Home / Learn

Common JSON errors and how to fix them

2 min read · Updated November 22, 2026

JSON looks like JavaScript but is much stricter. Most "invalid JSON" errors come from a short list of mistakes.

1. Trailing commas

JSON does not allow a comma after the last item.

{"a": 1, "b": 2,} ✗
{"a": 1, "b": 2} ✓

2. Single quotes

Strings and keys must use double quotes.

{'name': 'Ada'} ✗
{"name": "Ada"} ✓

3. Unquoted keys

Every key is a double-quoted string.

{name: "Ada"} ✗
{"name": "Ada"} ✓

4. Comments

JSON has no comments. Remove // and /* */ lines, or store notes as a normal field.

5. Unescaped characters in strings

Double quotes and backslashes inside a string must be escaped, and a string cannot contain a raw line break. Use \" for a quote, \\ for a backslash and \n for a new line.

6. Values JSON does not support

NaN, Infinity and undefined are not valid. Use null, or a number or string instead. Numbers cannot have leading zeros such as 007.

7. Missing or extra brackets

Every opening brace or bracket needs a match. Formatting the JSON with indentation makes mismatches easy to see.

How to debug

Paste your JSON into the formatter. The error message points to where parsing failed. The real mistake is often just before that spot, for example a missing comma on the previous line. Your data is parsed in your browser and never sent anywhere.

Try it nowThese tools run in your browser, so nothing is uploaded.
JSON Formatter & ValidatorRegex TesterBase64 Encoder & Decoder

More guides

How to make a strong password you can actually manageWhy length and uniqueness matter more than clever symbols, and how passphrases, managers and two-step sign-in fit together.2 min read