JSON troubleshooting
Expecting ',' delimiter / Expected ',' or '}' after property value
Fix missing commas and unescaped double quotes behind Python Expecting ',' delimiter and JavaScript Expected ',' or '}' errors, with exact messages by runtime.
What the error means
The parser finished one member of an object, or one element of an array, and expected a comma or the closing bracket next. It found another value instead. Usually a comma is missing between two members. The other common cause is a double quote inside a string value that is not escaped: the parser ends the string at that quote and then meets the rest of the text where a separator should be. Expecting ':' delimiter is the related error for a property name that is not followed by a colon.
Exact messages by runtime
Messages depend on the input and runtime version. Node and Python rows were reproduced locally. Other rows cite official documentation or source. Rows marked as fragments or templates preserve the source wording and are not complete exception transcripts. Browsers and libraries may append location details.
| Runtime | Message | Input and evidence |
|---|---|---|
| Python | json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 8 (char 7) | json.loads('{"a":1 "b":2}')Reproduced in Python 3.14.4 |
| Python, missing colon | json.decoder.JSONDecodeError: Expecting ':' delimiter: line 1 column 6 (char 5) | json.loads('{"a" 1}')Reproduced in Python 3.14.4 |
| Python 2.7, byte strings | ValueError: Expecting , delimiter | json.loads on a str (byte string) with a missing commaCPython 2.7.18 C scanner; unicode input quotes the comma. Location suffix omitted |
| JavaScript / V8 | SyntaxError: Expected ',' or '}' after property value in JSON at position 7 (line 1 column 8) | JSON.parse('{"a":1 "b":2}')Reproduced in Node.js 24.21.0 |
| JavaScript / V8, array | SyntaxError: Expected ',' or ']' after array element in JSON at position 3 (line 1 column 4) | JSON.parse('[1 2]')Reproduced in Node.js 24.21.0 |
| V8 10.2 / Node.js 18 | SyntaxError: Unexpected string in JSON at position 7 | JSON.parse('{"a":1 "b":2}'); [1 2] gives Unexpected number in JSON at position 3V8 10.2 message templates; the position is where the unexpected token starts |
| Firefox | SyntaxError: JSON.parse: expected ',' or '}' after property value in object at line 1 column 8 of the JSON data | JSON.parse('{"a":1 "b":2}')Source-derived from Firefox 158 JSONParser.cpp and its message template |
| Safari / JavaScriptCore | JSON Parse error: Expected '}' | Missing comma in an objectJavaScriptCore source (WebKit tag webkitgtk-2.54.1) with the JSON Parse error prefix |
| Go / encoding/json | invalid character '"' after object key:value pair | json.Unmarshal of {"a":1 "b":2}Source-derived from the Go 1.27 scanner |
| Java / Jackson | Unexpected character ('"' (code 34)): was expecting comma to separate Object entries | {"a":1 "b":2}Source-derived from Jackson 2.22; location suffix omitted |
| C# / System.Text.Json | '"' is invalid after a value. Expected either ',', '}', or ']'. | {"a":1 "b":2}Official .NET 10 resource template with the quote substituted; path and location omitted |
Causes you can reproduce
A comma is missing between members
Hand-edited JSON loses a comma when a line is added or moved. The parser only notices at the next member, so here it reports line 3 although the comma belongs at the end of line 2.
import json
json.loads('{\n "a": 1\n "b": 2\n}')
# Expecting ',' delimiter: line 3 column 3 (char 13)A double quote inside a string is not escaped
The quote before hi closes the string "say ". The parser then finds hi where a comma or closing brace must be. Inside a JSON string a double quote is written as a backslash followed by the quote, which a serializer does for you.
const text = '{"msg":"say "hi""}';
JSON.parse(text);
// Expected ',' or '}' after property value in JSON at position 13Records were joined without separators
Concatenating objects produces text that is neither one array nor NDJSON. If each record is on its own line by design, read the input as NDJSON instead.
const text = '[' + '{"a":1}' + '{"a":2}' + ']';
JSON.parse(text);
// Expected ',' or ']' after array element in JSON at position 8How to fix it
- Open the reported line and column. Check the character there and the end of the member before it: a missing comma belongs after the previous value, not at the reported position.
- If the previous value is complete, add the comma. If the parser stopped inside what should be one string, look for an unescaped double quote earlier in that string.
- Fix the producer. Build the value as an object or array and serialize it, instead of concatenating JSON fragments or inserting text between quotes.
- Validate the whole document again. Hand-edited files often have more than one missing comma.
Let JSON.stringify escape quotes
The serializer writes the inner quotes as escapes, and parsing restores the original string.
const value = { msg: 'say "hi"' };
const text = JSON.stringify(value);
console.log(text); // {"msg":"say \"hi\""}
console.log(JSON.parse(text).msg === value.msg); // trueSerialize records with json.dumps
json.dumps writes the separators. Build the list first instead of writing objects one by one.
import json
records = [{"a": 1}, {"a": 2}]
text = json.dumps(records)
print(text) # [{"a": 1}, {"a": 2}]
assert json.loads(text) == recordsPrint the text around a Python error
JSONDecodeError carries msg, pos, lineno and colno. A slice around pos shows the unescaped quote or the missing comma.
import json
text = '{"msg":"say "hi""}'
try:
json.loads(text)
except json.JSONDecodeError as error:
print(error.msg, error.lineno, error.colno) # Expecting ',' delimiter 1 14
print(text[error.pos - 6:error.pos + 5]) # "say "hi""}Find the exact position with Tool Kumar
- Copy the exact input text, including its original whitespace. For HTTP failures, copy the raw response body.
- Open the Tool Kumar JSON validator and paste the text. The document stays in your browser.
- Read the line and column in the error or fixable-issue banner. For an invalid document, select Go to error to move the caret to that location.
- Inspect the preceding token as well as the marked character. A parser marks where it discovered the problem; the missing quote, separator or value can start earlier.
Python character offsets are zero-based, while its displayed lines and columns are one-based. V8 string positions count UTF-16 code units; Go offsets count bytes read. Unicode text can make these offsets differ. Use the original text and its line/column context rather than copying an offset between runtimes.
Tool Kumar can classify some input as fixable loose JSON. Review a proposed change before using the JSON repair tool, then validate the result against your API contract. For empty input, inspect the producer or response because there is no character to select.
Frequently asked questions
Why does the error point to the line after the missing comma?
The parser cannot know that a comma is missing until it reads the next member, so it reports where that member starts. Add the comma after the last value of the previous member.
Can an unescaped quote cause Expecting ',' delimiter?
Yes. A double quote inside a value ends the string early, and the rest of the value is read as an unexpected token. Escape the quote, or serialize the value with JSON.stringify or json.dumps.
What does Expecting ':' delimiter mean?
A property name was read, but the next character is not a colon. Look for a missing colon, a missing quote that merged a key with its value, or a value written without a key.
Can Tool Kumar add missing commas?
The validator marks the position, and its repair inserts a comma between two members or array items when the next one clearly starts. It cannot know where a string with an unescaped quote was meant to end, so review each repair and fix that case at the source.
Related errors and tools
- JSON trailing comma errors in objects and arrays
- Expecting property name enclosed in double quotes
- Bad escaped character in JSON / Invalid \escape
- JSONDecodeError: Extra data and multiple JSON values
- All JSON error guides
- JSON syntax reference
- Repair missing commas and other common mistakes
Standards and diagnostic sources
RFC 8259 and ECMA-404 define JSON syntax. Diagnostic wording belongs to the parser. The table links each cited message to its source.