JSON-Arch Logo
JSON-Arch
Troubleshooting Guide

How to Fix Invalid JSON: Common Errors & Solutions

Getting SyntaxError: Unexpected token when parsing JSON? This guide walks through the top 6 JSON errors and how to repair them.

1Trailing Commas (Comma at end of object/array)

Unlike JavaScript arrays, standard RFC 8259 JSON does not allow trailing commas after the last property or item.

❌ Broken{ "id": 1, "name": "App", }
✓ Fixed{ "id": 1, "name": "App" }

2Single Quotes Instead of Double Quotes

JSON requires double quotes around both property keys and string values. Single quotes triggers Unexpected token '.

❌ Broken{ 'status': 'success' }
✓ Fixed{ "status": "success" }

3Unquoted Property Keys

In JavaScript object literals, key quotes are optional. In standard JSON, unquoted keys produce syntax errors.

❌ Broken{ title: "Developer Tools" }
✓ Fixed{ "title": "Developer Tools" }

4Unescaped Internal Quotes or Backslashes

Quotes inside string values must be escaped with a backslash (\").

❌ Broken{ "msg": "He said "Hello"" }
✓ Fixed{ "msg": "He said \"Hello\"" }

Automatically detect and pinpoint errors in your JSON

Our JSON Validator pinpoints exact line numbers and column positions for any syntax error: