JSON syntax error guide

Trailing Comma in JSON: What It Means and How to Fix It

Standard JSON does not allow a comma after the final property in an object or the final value in an array. JavaScript and several JSON-like formats permit trailing commas, which makes this one of the most common copy-and-paste failures.

What this JSON error means

Typical parser message
SyntaxError near a trailing comma before } or ]

Look immediately before each closing brace and bracket. If the previous non-whitespace character is a comma, remove it for strict RFC 8259 JSON.

Broken JSON vs. corrected JSON

Compare the invalid syntax with a corrected version before applying the same change to your payload.

Invalid JSON

{"name":"Ada","active":true,}

Valid JSON

{"name":"Ada","active":true}

Common causes of this JSON error

  • Copying a JavaScript or TypeScript object literal into a .json file
  • Formatting tools configured to preserve trailing commas
  • Deleting the last item but leaving its comma behind
  • Confusing JSON with JSON5 or JSONC

Fix and validate your JSON

After correcting the suspected syntax, run the complete payload through a validator. If it still fails, use the diagnostic tool to locate the next parser error before formatting the final JSON.

Related JSON errors

JSON error FAQ

What does Trailing Comma in JSON mean?

Standard JSON does not allow a comma after the final property in an object or the final value in an array. JavaScript and several JSON-like formats permit trailing commas, which makes this one of the most common copy-and-paste failures.

How do I fix Trailing Comma in JSON?

Look immediately before each closing brace and bracket. If the previous non-whitespace character is a comma, remove it for strict RFC 8259 JSON.