Expecting ',' delimiter: line L column C (char N)
The parser expected the current container to continue with a comma. The confusing part is that the position often points somewhere that looks perfectly fine, because the real mistake is slightly earlier: usually a quote that ended a string sooner than you intended.
Paste your JSON and see exactly where it breaks
Nothing you paste leaves your browser. The connect-src allowlist makes that a browser guarantee rather than a promise. Check it yourself
What actually causes it
Ranked by how often each one turns out to be the answer.
-
01 An unescaped double quote inside a string
The inner quote closes the string early, so the following text is read as a new token where a comma was expected. The top Stack Overflow question for this error is literally titled "Valid JSON giving JSONDecodeError", which is the whole experience in one line.
Breaks
{"quote": "he said "yes" loudly"}Works
{"quote": "he said \"yes\" loudly"} -
02 A genuinely missing comma
Between two members of an object or two elements of an array.
-
03 A single backslash before the closing quote
A Windows path ending in a backslash escapes the quote, so the string runs on and the next comma never arrives where the parser expects it.
-
04 The file is truncated
If the position is the end of the input, the document was cut short rather than misplaced.
The same mistake in other runtimes
The underlying problem is identical; only the wording differs. If a colleague reports one of these, they are looking at the same thing you are.
| JavaScript (V8) | Expected ',' or '}' after property value in JSON at position N |
|---|
Questions
- The JSON looks correct to me. Why does it fail?
- Look at the character immediately before the reported position rather than at the position itself. An early-terminated string is invisible until you notice the quote count. Pasting the document into a validator that colours strings makes it obvious in a second.
- How do I stop this happening?
- Never build JSON by concatenating strings. Build a dict and call json.dumps, which escapes every value correctly by construction.
Fix it now
Paste the payload into the tool above, or go straight to the one built for this job.
Highlight the strings