Invalid Escape Character in JSON: What It Means and How to Fix It
A backslash starts an escape sequence inside a JSON string. Only a defined set of escapes is legal, so paths such as C: emp or regex patterns frequently fail when their backslashes are not escaped correctly.
What this JSON error means
SyntaxError: Bad escaped character / invalid escape sequenceInspect every backslash inside the failing string. Literal backslashes must be represented as \ in JSON source, while valid escapes include ", \, /, \b, \f, \n, \r, \t, and \u followed by four hexadecimal digits.
Broken JSON vs. corrected JSON
Compare the invalid syntax with a corrected version before applying the same change to your payload.
Invalid JSON
{"path":"C:\temp\new"}Valid JSON
{"path":"C:\\temp\\new"}Common causes of this JSON error
- ●Windows file paths with single backslashes
- ●Regular expressions pasted directly into JSON
- ●A backslash before a character JSON does not recognize
- ●A malformed Unicode escape such as \u12G4
Fix and validate your JSON
After correcting the suspected syntax, run the complete payload through a validator. If it still fails, use the diagnostic tool to locate the next parser error before formatting the final JSON.
Related JSON errors
JSON Unexpected Token Error
Understand and fix JSON unexpected token errors. See broken and corrected examples, common causes, and a fast workflow for finding the exact invalid character.
Unexpected End of JSON Input
Fix “Unexpected end of JSON input” errors caused by truncated JSON, missing braces or brackets, incomplete strings, and empty API responses.
Trailing Comma in JSON
Learn why trailing commas are invalid in standard JSON and fix objects or arrays copied from JavaScript, TypeScript, JSON5, or configuration files.
Single Quotes in JSON
Fix invalid JSON that uses single quotes. JSON requires double quotes around property names and string values.
JSON Property Names Must Be Double-Quoted
Fix JSON with unquoted object keys. Standard JSON requires every property name to be enclosed in double quotes.
Comments Are Not Allowed in JSON
Learn why // and /* */ comments make strict JSON invalid, and when to use JSONC, JSON5, or separate metadata instead.
JSON error FAQ
What does Invalid Escape Character in JSON mean?
A backslash starts an escape sequence inside a JSON string. Only a defined set of escapes is legal, so paths such as C: emp or regex patterns frequently fail when their backslashes are not escaped correctly.
How do I fix Invalid Escape Character in JSON?
Inspect every backslash inside the failing string. Literal backslashes must be represented as \ in JSON source, while valid escapes include ", \, /, \b, \f, \n, \r, \t, and \u followed by four hexadecimal digits.