Unterminated string in JSON
A string opens but never closes, so the parser consumes the rest of the document looking for the closing quote. A double quote inside string content that was not escaped produces the same symptom.
The input
{"a": "hello}{"a": "hello"}How to fix it
Escape internal double quotes as `\"`, and check that every string has a matching closing quote.
The reported position is usually the end of the document, not the offending quote. Look for the last string that opens and search forward from there.
What each parser reports
Every message below was captured by running this exact input through the parser named. 21 of 21 parsers rejected it.
| Parser | Exact message |
|---|---|
| CPython json.loads CPython 3.12.3 | Unterminated string starting at: line 1 column 7 (char 6)what this message means → |
| encoding/json Unmarshal Go go1.22.2 | unexpected end of JSON inputwhat this message means → |
| Gson Java 21.0.12 | Unterminated string at line 1 column 14 path $.awhat this message means → |
| Gson JsonParser (lenient off) Java 21.0.12 | Unterminated string at line 1 column 14 path $.awhat this message means → |
| hjson Node.js 22.22.2 | Bad string at line 1,13 >>>"a": "hello} ...what this message means → |
| Jackson ObjectMapper Java 21.0.12 | Unexpected end-of-input: was expecting closing quote for a string valuewhat this message means → |
| JavaScriptCore JSON.parse JavaScriptCore (Bun 1.4.1) | JSON Parse error: Unterminated stringwhat this message means → |
| json-bigint Node.js 22.22.2 | Bad string |
| JSON5 Node.js 22.22.2 | JSON5: invalid end of input at 1:14what this message means → |
| JSON::PP Perl 5.038002 | unexpected end of string while parsing JSON string, at character offset 13 (before "(end of string)")what this message means → |
| json_decode PHP 8.3.6 | Control character error, possibly incorrectly encoded |
| Newtonsoft.Json JsonConvert Newtonsoft.Json 13.0.3 on .NET 8.0.30 | Unterminated string. Expected delimiter: ". Path 'a', line 1, position 13.what this message means → |
| Newtonsoft.Json JsonTextReader Newtonsoft.Json 13.0.3 on .NET 8.0.30 | Unterminated string. Expected delimiter: ". Path 'a', line 1, position 13.what this message means → |
| orjson CPython 3.12.3 | unexpected end of data: line 1 column 14 (char 13)what this message means → |
| Ruby JSON.parse Ruby 3.2.3 | unexpected token at '{"a": "hello}' |
| serde_json::from_str Rust (serde_json 1.x) | EOF while parsing a string at line 1 column 13what this message means → |
| SpiderMonkey JSON.parse SpiderMonkey 115 | JSON.parse: unterminated string at line 1 column 14 of the JSON datawhat this message means → |
| System.Text.Json Deserialize .NET 8.0.30 | Expected end of string, but instead reached end of data. Path: $ | LineNumber: 0 | BytePositionInLine: 13.what this message means → |
| System.Text.Json JsonDocument .NET 8.0.30 | Expected end of string, but instead reached end of data. LineNumber: 0 | BytePositionInLine: 13.what this message means → |
| ujson CPython 3.12.3 | Unmatched '"' when decoding 'string'what this message means → |
| V8 JSON.parse Node.js 22.22.2 | Unterminated string in JSON at position 13 (line 1 column 14)what this message means → |
What the specification says
The exact sections that govern this error. Descriptions are our paraphrase; follow the links for the normative text.
| Body | Section |
|---|---|
| IETF | A string begins and ends with a quotation mark. Any Unicode character may appear between them except the quotation mark, the reverse solidus, and the control characters U+0000 through U+001F, which the section requires to be escaped. It also fixes the escape set and the \uXXXX form. |
| Ecma International | A string is code points wrapped in quotation marks; the quotation mark, reverse solidus and U+0000–U+001F must be escaped. Table 3 fixes the escape sequences. |
Other errors in this category
Unclosed object — unexpected end of JSON input
The document ends before its closing brace. Caused by truncated downloads, a response cut off by a timeout, a log line that hit a …
Unclosed array — unexpected end of JSON input
The array's closing bracket is missing, usually for the same transport or buffer reason as an unclosed object.…