Unexpected End of JSON Input – Causes and Fixes
This error means parsing reached the end of the text before the JSON value was complete. Missing closing braces, brackets, quotes, truncated responses, and empty input are common causes.
Read fixJSON error index
Diagnose JSON parser errors, malformed payloads, escaping mistakes, truncated responses, and JavaScript values that are not valid JSON.
Diagnostic workflow
Start with the exact parser message and the smallest payload that still fails. JSON errors are usually caused either by invalid syntax in the document or by upstream code supplying the wrong kind of value, so separate those two cases before changing the data.
Browse focused fixes
36 troubleshooting pages
This error means parsing reached the end of the text before the JSON value was complete. Missing closing braces, brackets, quotes, truncated responses, and empty input are common causes.
Read fixAn unexpected token error means the parser found a character or value that cannot appear at that position in valid JSON. The reported token is often where the parser notices an earlier syntax mistake.
Read fixA less-than sign at the start of a supposed JSON response usually means the body is HTML, not JSON. Check the raw response, status code, content type, redirects, and endpoint before trying to repair the payload.
Read fixStandard JSON does not allow a comma after the final object property or array item. The repair workspace starts with a trailing-comma example and shows each removed comma before you use the corrected JSON.
Read fixJSON strings and object keys must use double quotes. Single quotes are valid in JavaScript source but not standard JSON, so each conversion should be reviewed for apostrophes and escape behavior.
Read fixEvery JSON object key must be a double-quoted string. Identifier-style keys such as name or active are JavaScript object syntax, not valid JSON, and should be quoted before parsing.
Read fixStandard JSON does not support line or block comments. If comments were copied from JavaScript or a JSON-like configuration file, remove them without touching comment-like text inside quoted strings.
Read fixJSON object properties and array items must be separated by commas. A parser often reports the next key or value as unexpected when the real mistake is a missing separator immediately before it.
Read fixEvery JSON object member uses a colon between its quoted key and value. When the colon is missing, the parser usually fails as soon as it reaches the value that follows the key.
Read fixA JSON object opened with { must eventually close with }. If the source ends or a different delimiter appears first, the parser can report an unexpected end or mismatched structure.
Read fixA JSON array opened with [ must close with ]. Missing or mismatched array delimiters often surface as unexpected-end errors or parser failures at a nearby closing brace.
Read fixA backslash inside a JSON string must begin a supported escape such as \n, \t, \uXXXX, \", or \\. Raw Windows paths and unsupported sequences can make otherwise readable strings invalid JSON.
Read fixUnexpected token o often appears when JSON.parse receives a JavaScript object instead of JSON text. The object is coerced to [object Object], which is not valid JSON.
Read fixUnexpected token u commonly means undefined reached JSON.parse. The parser sees the text undefined, which is a JavaScript value but not valid JSON.
Read fixThis error means one complete JSON value ended successfully, but non-whitespace content followed it. Common causes are concatenated objects, JSONL input, or accidental suffix text.
Read fixAn object parser expects a double-quoted property name after an opening brace or comma. JavaScript-style keys, stray punctuation, or an incomplete property can trigger this message.
Read fixAfter a complete object value, JSON allows either a comma for another property or a closing brace to end the object. Any other token can trigger this error.
Read fixEvery JSON object property uses a colon between its quoted name and value. If another token appears after the key, the parser reports that a colon was expected.
Read fixAn unterminated JSON string starts with a double quote but never reaches a valid closing quote before the input ends or another invalid character interrupts it.
Read fixA JSON string cannot contain a literal line break. Newlines inside a quoted value must be represented with an escape such as \n in the raw JSON text.
Read fixA double quote ends a JSON string unless it is escaped. Quotation marks that belong inside the value must be written as \" in raw JSON text.
Read fixJSON strings cannot contain unescaped control characters from U+0000 through U+001F. Tabs, newlines, carriage returns, and similar characters must use JSON escape syntax.
Read fixA JSON Unicode escape must use \u followed by exactly four hexadecimal digits. Missing digits or characters outside 0-9 and A-F make the string invalid.
Read fixStandard JSON numbers cannot use unnecessary leading zeros. Values such as 01 or 007 are invalid numbers and may need either the zero removed or the value stored as a string.
Read fixAn empty string contains no JSON value. If code reaches JSON.parse with an empty response or blank stored value, handle that state explicitly before parsing.
Read fixundefined is a JavaScript value, not JSON text. The fix is usually to correct the value flow before parsing rather than trying to make undefined valid JSON.
Read fixIf JSON parsing fails at < or <!DOCTYPE, the response may be HTML rather than broken JSON. Inspect the raw HTTP response before editing the payload.
Read fixTruncated JSON is structurally incomplete because part of the original payload is missing. A parser location can show where input stopped, but the safest fix is usually to recover the missing source data.
Read fixStandard JSON contains one top-level value. Two objects concatenated together are not one valid JSON document even when each object is valid on its own.
Read fixDouble-encoded JSON is valid JSON text whose parsed result is another serialized JSON string. The symptom is often extra backslashes and quotes around an object that should already be structured data.
Read fixEscaped JSON often appears when JSON text is embedded inside another string layer. Decode the intended layer rather than globally removing backslashes.
Read fixA UTF-8 BOM is an invisible U+FEFF character that may appear before the first JSON token. VetaTool accepts one leading BOM while preserving error offsets against the original input.
Read fixJavaScript object-literal syntax is broader than JSON. Code that works inside JavaScript source can still fail when copied into a .json file, API body, or JSON.parse call.
Read fixNaN is a JavaScript numeric value but is not part of the JSON number grammar. VetaTool can replace it with null as a review-required placeholder so you can choose the correct domain value.
Read fixInfinity and -Infinity exist in JavaScript but standard JSON only represents finite numbers. Repair requires an explicit semantic choice for downstream data.
Read fixundefined can exist in JavaScript objects but not in JSON text. VetaTool can create a null placeholder for review while keeping the semantic decision explicit.
Read fixUnderstand the underlying concepts
2 related guides
Learn how to find and fix missing commas, unquoted keys, trailing commas, invalid escapes, hidden characters, and other common JSON errors.
Read guideLearn how JSON escaping works for quotes, backslashes, control characters, newlines, Unicode escapes, and double-encoded JSON with practical examples.
Read guide