JSON syntax is strict. A single misplaced comma or wrong quote character can render an entire file unparseable, and the error messages you get from most parsers are famously unhelpful. Here are the errors that come up most often, what causes them, and how to fix them.
1. Single Quotes Instead of Double Quotes
JSON requires double quotes for all strings and keys. Single quotes are not valid JSON, even though they work fine in JavaScript.
// Wrong
{'name': 'Sourav'}
// Right
{"name": "Sourav"}
This is the single most common JSON error, especially among developers coming from JavaScript or Python. If your JSON won't parse, check for single quotes first.
2. Trailing Commas
Many programming languages allow a comma after the last element in an array or object. JSON does not.
// Wrong
{"name": "Sourav", "age": 25,}
// Right
{"name": "Sourav", "age": 25}
Trailing commas are easy to miss because they don't cause problems in JavaScript objects. Linters like ESLint can catch these before they reach production.
3. Unquoted Property Names
In JavaScript, you can write {name: "Sourav"} without quoting the key. In JSON, all property names must be wrapped in double quotes.
// Wrong
{name: "Sourav"}
// Right
{"name": "Sourav"}
4. Comments in JSON
JSON does not support comments. You cannot use // or /* */ inside a JSON file. If you need documentation, keep it in a separate file or use a format like JSONC or JSON5 that supports comments. For configuration files, consider YAML or TOML instead.
5. Mismatched Brackets and Braces
Every opening { must have a closing }, and every opening [ must have a closing ]. When JSON gets deeply nested, it's easy to miss a closing bracket. The validator on this site will show you exactly where the mismatch occurs.
6. Using Non-String Keys
JSON keys must be strings (wrapped in double quotes). You cannot use numbers, booleans, or null as keys.
// Wrong
{1: "first", 2: "second"}
// Right
{"1": "first", "2": "second"}
7. Invalid Escape Sequences
JSON supports a limited set of escape sequences: \n, \t, \r, \\, \", \/, and \uXXXX for Unicode. Using unsupported escapes like \' or \0 will cause a parse error.
8. Incorrect Number Formats
JSON numbers cannot have leading zeros (except for 0.x), cannot include + signs, and cannot use NaN or Infinity. Hexadecimal numbers like 0xFF are also not valid in JSON.
// Wrong
{"port": 08080, "score": +10, "value": NaN}
// Right
{"port": 8080, "score": 10, "value": null}
How to Avoid These Errors
- Always run JSON through a validator before using it in production
- Use a linter or editor with JSON syntax checking (VS Code does this by default)
- Generate JSON programmatically using your language's built-in serializer rather than hand-writing it
- When debugging, paste the JSON into the validator above — it pinpoints the exact position of syntax errors
All processing on this site happens in your browser. Your JSON never gets uploaded, which means you can safely paste API responses, configuration files, or any other data without worrying about privacy.