Skip to content

Common JSON Errors

Anne LoVerso edited this page Apr 1, 2021 · 1 revision

Beware of these common problems with validating JSON:

Unpaired quotation marks

Everyone needs to have a buddy. Here, "lease-and-permits" is missing its closing buddy and "task" is missing its opening buddy.

[
    {
      "step": "lease-and-permits,
      "weight": 50,
      task": "floor-plan-approval-doh"
    }
]

Unpaired object brackets

Everyone needs to have a buddy. Here, we're missing a closing }

[
  {
    "step": "lease-and-permits",
    "weight": 50,
    "task": "floor-plan-approval-doh"
]

Unpaired list brackets

Everyone needs to have a buddy. Here, we're missing an opening [

  {
      "step": "lease-and-permits",
      "weight": 50,
      "task": "floor-plan-approval-doh"
    }
]

Trailing commas for lists

The last item in a list should not have a comma after it. Here, the }, comma should be removed

[
  {
    "step": "lease-and-permits",
    "weight": 50,
    "task": "floor-plan-approval-doh"
  },
]

Trailing commas for properties

The last property in an object should not have a comma after it. Here, the "floor-plan-approval-doh", comma should be removed

[
  {
    "step": "lease-and-permits",
    "weight": 50,
    "task": "floor-plan-approval-doh",
  }
]

Missing commas for properties

There should be a comma between properties. Here, "step": "lease-and-permits" neeeds a comma after it.

[
  {
    "step": "lease-and-permits"
    "weight": 50,
    "task": "floor-plan-approval-doh"
  }
]

Missing commas for lists

There should be a comma between items in a list. Here, we need a comma after the closing } for the first object.

[
  {
    "step": "lease-and-permits",
    "weight": 50,
    "task": "floor-plan-approval-doh"
  }
  {
    "step": "lease-and-permits",
    "weight": 10,
    "task": "food-safety-course"
  }
]

Missing/incorrect quotation marks

All text should be enclosed in ". Single quotes (') are not valid. Here, 'step' and floor-plan-approval-doh are both incorrect. Note: weight does not need quotation marks because it is a number, not text.

[
  {
    'step': "lease-and-permits",
    "weight": 50,
    "task": floor-plan-approval-doh
  }
]