Common JSON Errors and How to Fix Them

The most common JSON errors are: trailing commas, single-quoted strings, unquoted keys, missing quotes around string values, comments (not valid in JSON), and incorrect nesting. All of them cause a parse exception. Paste your JSON into the JSON Validator to pinpoint the exact line and character causing the error.

Try it directly in your browser:

Validate your JSON →

1. Missing comma between properties

Every property in an object and every item in an array must be separated by a comma — except the last one. Forgetting a comma is the most frequent JSON error, especially when adding new fields manually.

// Error — missing comma after "name"
{
  "name": "Alice"
  "age": 28
}

// Fixed
{
  "name": "Alice",
  "age": 28
}

2. Trailing comma after the last item

Standard JSON does not allow a comma after the last property in an object or the last element in an array. This is valid JavaScript but not valid JSON.

// Error — trailing comma after "editor"
{
  "roles": [
    "admin",
    "editor",
  ]
}

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

3. Single quotes instead of double quotes

JSON requires double quotes for all string keys and string values. Single quotes are valid in JavaScript but will cause a JSON parse error every time.

// Error — single quotes are not valid JSON
{ 'status': 'active' }

// Fixed
{ "status": "active" }

4. Unquoted keys

In JavaScript you can write { name: "Alice" } without quoting the key. In JSON, every key must be a double-quoted string. Unquoted keys cause an immediate parse error.

// Error — key is not quoted
{ name: "Alice" }

// Fixed
{ "name": "Alice" }

5. Unescaped special characters inside strings

Certain characters inside JSON strings must be escaped with a backslash. The most common ones are " (quote), \ (backslash), \n (newline), and \t (tab). An unescaped quote inside a string breaks the parser immediately.

// Error — unescaped double quote inside string
{ "message": "She said "hello" to me" }

// Fixed — quote escaped with backslash
{ "message": "She said \"hello\" to me" }

6. Invalid value types

JSON supports only six value types: strings, numbers, booleans (true / false), null, objects, and arrays. JavaScript-specific values like undefined, NaN, Infinity, and functions are not valid JSON.

// Error — undefined is not a valid JSON value
{ "score": undefined }

// Fixed — use null for missing values
{ "score": null }

7. Mismatched or missing closing brackets

Every { must have a matching }, and every [ must have a matching ]. When you have deeply nested JSON, it is easy to lose track of where one object ends and another begins. Formatters and validators both make this visible instantly.

// Error — missing closing brace
{
  "user": {
    "name": "Alice"


// Fixed
{
  "user": {
    "name": "Alice"
  }
}

How to find errors fast

Reading through JSON manually to find a syntax error is slow and error-prone. The fastest approach is to paste your JSON into a validator. A good validator will tell you the exact line number and character position of the first error, so you can jump straight to the problem without scanning the entire file.

Once the error is fixed and the JSON validates, run it through a formatter to make the structure readable before sharing it or committing it to version control.

Frequently Asked Questions

What is the most common JSON error?

Missing comma between properties is the most frequent mistake. It is easy to miss when adding or removing fields manually.

How do I find the line number of a JSON error?

Paste your JSON into a JSON Validator. It reports the exact line number and character position of the first error it finds.

Validate and fix JSON errors instantly

Paste your broken JSON and get the exact error location. Free, private, no signup required.

Open JSON Validator

Looking for an exact error message?

The Error Reference lists verbatim error strings — CORS, fetch, JSON parse errors and more — with cause, code examples, and fixes.

Ready to validate your json?

Open JSON Validator →
About the author

Pasindu Ishan is a software developer based in Sri Lanka. He builds developer tools at JSON Dev Tools.