Trailing commas, smart quotes, and other copy-paste damage to JSON
The everyday ways JSON gets broken when people copy it from chat apps, docs, or JavaScript — with examples and fixes you can apply in under a minute.
I keep a short mental list of why paste fails. It is almost never "JSON is hard." It is that the text came from Slack, a Notion page, a JavaScript file, or a README that was never meant to be parsed. This article walks through the damage patterns I see weekly, what the parser usually says, and how to repair them without guessing.
Trailing commas from JavaScript habits
JavaScript allows a comma after the last property. JSON does not. Developers who live in JS will write a config that looks perfect and then watch a deploy fail on a YAML-adjacent JSON file. The parser error usually points near the closing brace, which feels unhelpful until you know to look one token earlier.
{
"host": "localhost",
"port": 8080,
}Smart quotes from chat and documents
Mail apps and many rich-text editors turn " into “ and ”. Those look almost identical in a dark theme. JSON requires straight ASCII double quotes for keys and strings. If Validate fails at the first character of a key you swear you typed correctly, select the quote and retype it, or paste into a plain-text box first.
Single quotes are the sibling problem. JSON does not accept 'name': 'Ada'. That is a JavaScript object literal, not JSON.
Comments that were never legal
People leave // notes in sample payloads because every tutorial in another language allows it. RFC 8259 JSON has no comments. Some "JSON with comments" tools exist for configs, but a strict API parser will reject them. Strip comments before you ship the file, or keep the notes outside the document.
{
// temporary until auth lands
"featureFlags": { "billing": false }
}A repair order that wastes less time
Fix the first reported position, re-validate, then fix the next. Do not hunt three errors at once. Replace curly quotes globally. Remove trailing commas. Delete comments. Confirm there is a single top-level value — two objects back to back are invalid unless they sit inside an array.
If the text still fails, check for truncated paste (a response cut off mid-string) and for double-encoded JSON: a string that itself contains a serialized object. In that case you need to parse twice, or ask the producer to stop stringifying twice.
Try the fix in a browser workspace
Paste the broken text into View My JSON, run Validate, and read the line or position it reports. Format only after it parses — pretty-printing cannot fix illegal syntax. The free tools stay in your browser for that loop, which is what you want when the payload might contain tokens you should not upload casually.
For a longer checklist of the seven errors that cover most failures, see the guide on how to fix invalid JSON on this site.