Common JSON errors

Most JSON syntax failures are repetitive. Once you know the common patterns, it becomes much easier to repair broken request bodies, config files, and copied payloads.

1. Trailing commas

JSON does not allow a comma after the last item in an object or array.

{
  "a": 1,
}

Fix it by removing the last comma.

2. Single quotes

JSON strings and keys must use double quotes, not single quotes.

{ 'name': 'Ada' }

Correct version:

{ "name": "Ada" }

3. Missing braces or brackets

If a nested object or array does not close correctly, the parser will fail even if most of the payload looks right.

{
  "items": [
    {"id": 1},
    {"id": 2}

4. Unquoted keys

Keys copied from JavaScript objects often lose their quotes.

{ name: "Ada" }

JSON requires:

{ "name": "Ada" }

5. Comments inside JSON

Many developers paste JSON into files that support comments and then forget that raw JSON does not.

{
  // This breaks JSON
  "active": true
}

How to prevent repeat errors

Validate the payload first, then format it so the structure is easy to inspect. If you are frequently copying data out of logs, sanitize the source before pasting it into a request body or config file.

Related JSON tools

FAQ

Why do trailing commas break JSON?

Because the JSON specification does not allow separators after the final element in an array or object.

Can comments ever be valid in JSON?

No. Some tools accept JSON-like extensions, but standard JSON itself does not support comments.

Why do unquoted keys work in JavaScript but not JSON?

JavaScript objects and JSON look similar, but JSON has stricter rules for portability and parsing.

What is the best next step after fixing the syntax?

Run the valid payload through JSON Formatter so it is easier to review.