Fix Broken JSON Instantly — Trailing Commas, Unquoted Keys, Smart Quotes
JSON parse errors are frustrating because the error messages rarely tell you what actually went wrong. This guide covers every common way JSON breaks, shows you the exact before/after, and gives you a one-click repair tool for when you just need it fixed now.
Trailing Commas
This is the number one source of broken JSON. JavaScript objects allow trailing commas since ES5, which means any JSON exported from a JS file or config system may carry them. Standard JSON (RFC 8259) rejects trailing commas entirely.
Trailing comma in an object
Remove the comma after the last property. JSON objects and arrays cannot have a comma after the final item.
Trailing comma in an array
The comma after "rest" is invalid. Array elements follow the same rule — no trailing comma.
If you write TypeScript/JavaScript and need trailing commas in your source code (common in Prettier config), use JSONC format or convert to plain JSON before sharing.
Unquoted Keys
JavaScript objects allow unquoted keys. JSON does not. If you've copied an object literal from a JavaScript file, the keys won't have quotes.
Unquoted keys (JavaScript object literal)
Every key in JSON must be wrapped in double quotes. This is one of the most meaningful differences between JSON and JavaScript object notation.
The fix is mechanical: wrap each key in quotes. A repair tool handles this automatically. If you're doing it manually, be careful with keys that contain hyphens or spaces — they still need quotes in JSON.
Single Quotes
Python developers frequently hit this one. Python's str(dict) and repr() output uses single quotes. JSON only accepts double quotes.
Single-quoted strings (Python repr output)
Two problems here: single quotes need to become double quotes, and Python boolean True becomes JSON true (lowercase). Use json.dumps() in Python instead of str() to get valid JSON.
str(my_dict) to produce JSON. Always use import json; json.dumps(my_dict). The output is valid JSON every time.Smart Quotes from Word / Google Docs
Word processors auto-convert straight quotes (") to typographic "smart quotes" (“ and ”). When you copy JSON from a document that was edited in Word or Google Docs, these curly characters break every parser.
Smart quotes from a word processor
The curly open-quote (“) and close-quote (”) characters are not valid JSON string delimiters. Replace them with standard straight double-quote characters (ASCII 0x22).
This is particularly painful because smart quotes look almost identical to regular quotes in most fonts. The error message (Unexpected token ‘ at position 0) is the tell.
Missing Commas Between Properties
Less common but happens when JSON is generated by string concatenation or edited manually:
Missing comma between properties
Every property in a JSON object must be separated by a comma, except for the last one. A missing comma triggers a SyntaxError pointing to the line after the gap.
Truncated / Incomplete JSON
APIs that hit size limits, log truncation, or clipboard paste errors can leave you with JSON that simply ends mid-way. The jsonrepair library (used in our Repair tab) can often close open strings, arrays, and objects intelligently.
Truncated JSON (missing closing brackets)
Repair tools close open structures at the end. The repaired output is best-effort — always verify that the inferred structure matches your intent before using the result.
How to Read JSON Error Messages
JavaScript's JSON.parse() throws SyntaxError with position information. Here's a quick decoder:
Unexpected token } at position 47Unexpected token ‘ at position 0Unexpected token a at position 12Unexpected end of JSON inputUnexpected token / at position 5Repair JSON in One Click
Paste your broken JSON, hit the Repair tab. Our formatter uses the jsonrepair library to fix trailing commas, unquoted keys, single quotes, smart quotes, missing brackets, and more — browser-side, no data sent anywhere.
Open JSON Repair Tool
Comments in JSON
JSON has no comment syntax. None. Not
//, not/* */, not#. If you've copied a JSONC (JSON with Comments) config file — common in VS Code settings, TypeScript configs, and ESLint configs — you need to strip the comments before parsing.JSONC with comments (VS Code-style)
Remove all comment lines and inline comments. If you need comments in your config, keep it as .jsonc and use a JSONC parser (like strip-json-comments) before passing to JSON.parse().