JSON Invalid Escape Sequence

Inside a JSON string, only certain characters can follow a backslash. Any other character after \ causes an invalid escape error.

Common causes

How to fix

Examples

Bad

"path: C:\users\file"

Good

"path: C:\\users\\file"

FAQ

What are valid JSON escape sequences?
\" \\ \/ \b \f \n \r \t and \uXXXX for Unicode.
How do I put a newline in a JSON string?
Use \n inside the string, not a real newline.

Fix it now

Try in validator (prefill this example)

Related

All tools · Canonical