JSON Quotes and Escape Characters: Common Mistakes and Fixes
6 min read · Updated 2026-07-18
Every JSON key and string value uses double quotes. When text itself contains a double quote, a backslash, a line break, or a control character, it needs a valid JSON escape sequence.
Use double quotes for keys and text
Single quotes are common in JavaScript and Python examples, but they are not valid JSON delimiters. Replace them with double quotes before validating.
{
"message": "Hello, world"
}Escape characters inside a string
Use \" for a double quote, \\ for a backslash, \n for a newline, and \t for a tab. Do not press Enter inside a JSON string when you mean the two-character escape sequence \n.
{
"quote": "She said: \"Hello\"",
"path": "C:\\work\\data",
"note": "First line\nSecond line"
}Validate after editing text fields
A single unescaped quote can terminate a string early and make later text look like an unrelated JSON error. Validate after changing long messages, HTML fragments, or file paths.
Frequently asked questions
Can JSON use single quotes?
No. JSON requires double quotes around property names and string values.
How do I include a newline in JSON?
Use the escape sequence \n inside the string. A literal line break inside a quoted JSON string is invalid.
Related JSON guides
How to Fix Invalid JSON: A Practical Error-Checking Guide
Find the first JSON syntax error, understand common parser messages, and fix invalid JSON without changing valid data.
How to Fix Unexpected Token Errors in JSON
Learn what an unexpected token means in JSON, identify the character that caused it, and repair common syntax mistakes.
JSON Formatter vs JSON Validator: When to Use Each Tool
Understand the difference between formatting and validating JSON, choose the right workflow, and keep data private in your browser.