JSON Escape
Escape and unescape JSON strings including unicode, newlines, and special chars
Shortcuts: Ctrl+Enter run · Ctrl+L clear · Ctrl+D download
About JSON Escape
This tool escapes and unescapes JSON strings, handling special characters including double quotes, backslashes, newlines, tabs, and Unicode code points. It is useful when you need to embed a JSON string as a value inside another JSON document, embed JSON inside a JavaScript string literal, or debug string encoding issues.
- ✓Escapes double quotes, backslashes, newlines, tabs, carriage returns, and form feeds
- ✓Handles Unicode escape sequences (\uXXXX)
- ✓Reverse mode: unescapes a previously escaped JSON string
- ✓Useful for embedding JSON inside other JSON strings or JavaScript source code
What JSON Escaping Actually Does
Inside a JSON string, a few characters cannot appear as-is. A double quote would end the string early, a backslash starts an escape sequence, and raw control characters such as newlines and tabs are not allowed at all. Escaping replaces each of these with a backslash sequence so the text can sit safely between double quotes. Unescaping reverses the process and gives you back the original text.
The escape sequences you will see
- ·\" — a literal double quote
- ·\\ — a literal backslash (so a Windows path C:\temp becomes C:\\temp)
- ·\n, \r and \t — newline, carriage return and tab
- ·\b and \f — backspace and form feed, rarely seen in practice
- ·\u0000 to \u001f — any other control character, written as a Unicode escape
Everything else, including accented letters, emoji and other non-ASCII characters, is left as-is. JSON is defined as Unicode text, so é does not need to be written as \u00e9.
Before and after
Input text:
Line 1
Tab here "quoted" C:\path
Escaped:
Line 1\nTab\there \"quoted\" C:\\pathThe escaped output is exactly what goes between the quotes of a JSON string value. This tool uses the browser's own JSON.stringify to escape and JSON.parse to unescape, so the result matches what any standards-compliant JSON library will produce or accept.
When you need it
- ·Embedding a multi-line message, SQL query or HTML snippet as a value in a JSON config file
- ·Building a JSON request body by hand for curl or Postman when the value contains quotes
- ·Reading log output where a JSON payload was stored as an escaped string and is full of \n and \"
- ·Debugging double-escaping bugs, where a value has been escaped twice and shows \\n instead of \n
Unescape errors
Unescaping fails if the input is not a valid escaped string — usually because it contains an unescaped double quote or a backslash followed by a character that is not a valid escape (for example \x41, which is valid in JavaScript but not in JSON). The tool reports the error instead of silently returning the input, so you know the text needs fixing.
Tip: Escaping is not the same as stringifying a whole document. To turn an entire JSON object into one string value, use the JSON Stringify tool instead.