39 chars · 3 lines
Two-way sync · Edit either side and the other updates automatically.
"path": "C:\Users\Ada\new-folder"39 chars · 3 lines
Two-way sync · Edit either side and the other updates automatically.
"path": "C:\Users\Ada\new-folder"JSON string escape error
JSON gives backslash a special meaning inside strings. Only defined escapes are allowed, so copied Windows paths, regular expressions, or manually escaped text can fail when a backslash is followed by an unsupported character or an incomplete Unicode sequence. This tool is free to use. No account or payment is required.
Last updated
JSON supports a defined set of escapes for quotation marks, backslashes, control characters, and four-hex-digit Unicode escapes. A sequence such as \U or an incomplete \u code is not part of the JSON grammar.
If JSON text is itself stored inside a JavaScript string, JavaScript consumes one escape layer before JSON.parse sees the text. Debug the raw value passed to JSON.parse rather than counting backslashes only in source code.
A literal backslash in raw JSON must be represented as two backslash characters.
{
"path": "C:\Users\Ada"
}{
"path": "C:\\Users\\Ada"
}Common questions
A single backslash starts a JSON escape sequence. Literal path separators therefore need to be escaped as two backslash characters in raw JSON text.
JSON supports escaped quote, backslash, slash, backspace, form feed, newline, carriage return, tab, and Unicode escapes written as \u followed by four hexadecimal digits.
When JSON text is embedded inside a JavaScript string, one escape layer belongs to JavaScript and another belongs to JSON. Inspect the runtime string passed to JSON.parse to see the actual JSON text.
Debugging a specific JSON issue? Browse JSON troubleshooting.