Unterminated string in JSON
Unterminated string in JSON at position 13 (line 1 column 14)
An unterminated string error means the JSON parser found an opening double quote that was never closed before the end of the input or the end of the enclosing structure. The parser consumes characters looking for the closing quote, reaches something unexpected — either the end of the input or a structural character — and raises this error. It typically indicates a missing closing quote, an unescaped double quote inside the string, or truncated input.
Missing closing double quote
The simplest case: a string value or key is opened but never closed. Always ensure every opening " has a matching closing ".
Invalid
{"message": "Hello world}Valid
{"message": "Hello world"}Unescaped double quote inside the string
A literal double-quote character inside a JSON string must be escaped as \". An unescaped quote closes the string prematurely, and any following characters then cause a parse error.
Invalid
{"quote": "She said "hello" to me"}Valid
{"quote": "She said \"hello\" to me"}Backslash before the closing quote
A backslash immediately before the closing quote escapes the quote rather than ending the string. The parser continues past the intended end, consuming subsequent characters until it finds the real (now mismatched) next quote.
Invalid
{"path": "C:\\Users\\Alice\"}Valid
{"path": "C:\\Users\\Alice\\"}Truncated JSON from a file read or network buffer
If a JSON file is read in chunks or the network connection drops mid-stream, the last string may be incomplete. The symptom is an unterminated string near the end of the input rather than in the middle.
Invalid
{"items": ["alpha", "beta", "gamm // stream cut hereValid
{"items": ["alpha", "beta", "gamma"]}Fix this error in seconds
Paste your JSON in the free validator to find the exact line and column where the error occurs.
Open JSON Validator →Frequently Asked Questions
The error position is after a backslash — why?
A trailing backslash at the end of a string value (e.g., "path\\") escapes the closing quote, so the parser thinks the string continues. The position reported is wherever the parser ultimately ran out of valid string content. Check for an odd number of backslashes before a closing quote.
How can I automatically escape strings before inserting them into JSON?
Use JSON.stringify() on the string value alone: JSON.stringify(myString) returns a properly quoted and escaped JSON string literal including the surrounding quotes. Slice off the outer quotes if you only need the escaped interior: JSON.stringify(myString).slice(1, -1).