How to Fix "Unterminated String" in JSON
Published April 2025 · 3 min read
This error means a string in your JSON is missing its closing quote. Here are all the causes.
1. Missing Closing Quote
// ❌ Wrong
{"name": "John}
// ✅ Fixed
{"name": "John"}
2. Unescaped Quotes Inside String
// ❌ Wrong
{"text": "He said "hello""}
// ✅ Fixed
{"text": "He said \"hello\""}
3. Newlines in Strings
// ❌ Wrong — JSON doesn't allow literal newlines in strings
{"text": "line 1
line 2"}
// ✅ Fixed — use \n
{"text": "line 1\nline 2"}
4. Unescaped Backslashes
// ❌ Wrong
{"path": "C:\new\folder"}
// ✅ Fixed
{"path": "C:\\new\\folder"}
Quick Fix
Paste your JSON in our JSON Formatter — it shows exactly where the error is.