JSON Escape & Unescape
Escape and unescape JSON strings instantly. Escape special characters for embedding JSON in strings, or unescape to read raw JSON. Free, no signup.
JSON String Escaping — Special Characters and Why They Need Escaping
JSON strings have a problem: some characters have special meaning in JSON syntax itself. A double quote inside a string would confuse the parser into thinking the string ended early. A backslash introduces escape sequences. A newline character in a string would break the single-line JSON format. Escaping solves this by representing these characters with safe alternatives.
Characters that must be escaped
JSON requires escaping six characters inside strings: double quote (" → \"), backslash (\ → \\), newline (→ \n), carriage return (→ \r), tab (→ \t), and any control characters. Unicode characters can stay as-is in modern JSON, but can optionally be escaped as \uXXXX for maximum compatibility with ASCII-only systems.
The double backslash problem
Windows file paths cause frequent escaping confusion. The path C:\Users\Alice\Documents in JSON becomes "C:\\Users\\Alice\\Documents" — each single backslash must be doubled. When you see quadruple backslashes in JSON, it's representing a path with double backslashes, which represents a path with single backslashes. Two levels of escaping, one level of actual path.
When you need to escape JSON
Embedding JSON inside another JSON string: {"data": "{"name":"Alice"}"}. Storing JSON in database string columns. Passing JSON as a URL query parameter (though URL encoding is also needed). Including JSON in HTML attributes. Embedding JSON in shell commands. In all these cases, the JSON string itself must be escaped for the outer container format.