When a JSON parser rejects input, start with the exact text it received and the reported line, column, or character position. Check the nearby quotes, commas, colons, brackets, and values—then confirm the parser was given a complete JSON document rather than an error page or other text. The eight patterns below are practical troubleshooting cases, not a measured ranking of frequency.
Check the JSON rules before changing the data
JSON can represent an object, an array, a number, a string, or one of the lowercase literals true, false, and null. Object member names must be strings in double quotes, followed by a colon and a value; commas separate members. Arrays use commas to separate values. These rules come from RFC 8259, the JSON standard.
As an Amazon Associate I earn from qualifying purchases.
JavaScript object-literal syntax and JSON look similar, but they are not interchangeable. A parser’s error location is a useful clue, not a complete diagnosis: the cause may be just before the reported character, or the input may not be JSON at all.
Fix these eight practical JSON errors
1. Single quotes or unquoted property names
JSON strings and object names require double quotes. This is invalid: {'name': 'Ada'}. Write {"name": "Ada"} instead. An unquoted name such as {name: "Ada"} is also invalid. MDN’s JSON.parse error reference documents single-quoted property names among common parsing failures.
#1 Best Overall
2. A trailing comma
Do not put a comma after the final item in an object or array. Change {"items": [1, 2,]} to {"items": [1, 2]}. Trailing commas are permitted in some programming-language syntax, but not in JSON.
3. A missing comma or colon
Each object name needs a colon before its value, and a comma must separate one member from the next. For example, {"name" "Ada"} is missing a colon; {"name": "Ada" "active": true} is missing a comma. Arrays also need commas between values, as in [1, 2]. At the error location, inspect the separator just before and after the unexpected token.
4. A missing or mismatched brace or bracket
Every opening { needs a closing }, and every opening [ needs a closing ]. For example, {"items": [1, 2} closes the object’s array with the wrong character. If the parser reports an unexpected end, check whether the input was cut off before a string or container was closed.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →5. An unterminated string, embedded quote, or invalid escape
Close each string with a double quote. If a quotation mark or reverse solidus belongs inside a string, escape it: {"quote": "She said, "hello""} and {"path": "C:\temp"}. JSON also permits escapes such as n, t, and uXXXX. A literal control character from U+0000 through U+001F must be escaped. A backslash followed by an unsupported escape can trigger an error; MDN’s parser reference includes messages such as “bad escape character” and “bad control character in string literal.”
Rank #3
6. A malformed number
Numbers must follow JSON’s number grammar. A minus sign must be followed by a number; a decimal point must have digits after it; and an exponent marker must have exponent digits. Leading-zero forms such as 01 are invalid. Depending on the intended value, use 0, 1.0, or a complete exponent such as 1e3.
7. An invalid literal or JavaScript-only value
The only JSON literal names are lowercase true, false, and null. Values such as undefined, NaN, and Infinity are not JSON values. Replace one with a valid JSON value that accurately represents your data, or use a string deliberately—for example, "undefined" if the text itself is what you need to preserve.
8. Extra text, truncated input, or more than one document
A parser may reject an otherwise valid value if unexpected non-whitespace text follows it. The input may also end before the document is complete, contain multiple JSON values, or be a non-JSON response. If parsing fails at the start, inspect the raw response body and its content type: an API error may return HTML or plain text instead of JSON. This is a diagnostic possibility, not proof of what caused any particular failure.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Python’s JSONDecoder.raw_decode() can return the position where it finished decoding one document, which can help reveal trailing text. Consult the Python 3.14 JSON module documentation for details.
Debug a parser error in a reliable order
- Keep the exact failing input. Copy the complete parser error, including its line, column, or character position. Avoid reformatting the input before you inspect it.
- Inspect the nearby characters. Look for a quote, comma, colon, bracket, escape, or number that is missing, extra, or malformed. Remember that the actual mistake may precede the position reported.
- Check what was actually received. If the error is at or near the start, inspect the raw input. Determine whether it is empty, truncated, HTML, plain text, or something else rather than a JSON document.
- Correct and validate the complete document. Parse it with the same JSON parser your application uses. Python also documents
python -m jsonas a command-line way to validate and pretty-print JSON. - Do not use
eval()as a parser. RFC 8259 warns that evaluating JSON-like text can execute code and describes this as an unacceptable security risk. Use a JSON parser instead.
Duplicate object names are a separate interoperability problem
An object with repeated names may not be rejected as a syntax error, but different receivers can handle it differently: some keep the last value, some report an error, and some expose all pairs. RFC 8259 says, “The names within an object SHOULD be unique.” Use unique names when documents need to work consistently across implementations.
Make sense of parser messages
Messages such as “unexpected end of data,” “expected property name or ‘}’,” and “unexpected non-whitespace character after JSON data” can narrow the search. Their exact wording varies by parser. Treat the message and position as clues, then verify both the surrounding syntax and the complete input the application received.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Recommended Free Tools




