JSON Escape & Unescape

Escape text so it can be pasted between double quotes in JSON, or unescape a string like "line one\nline two" back to what it says.

Input · drop a file

Output

What gets escaped

CharacterEscaped
Double quote "\"
Backslash \\\
Newline\n
Carriage return\r
Tab\t
Other control characters\u00XX

Everything else, including emoji and accented letters, can stay as-is: JSON is UTF-8. Forward slashes may optionally be escaped as \/; this tool leaves them alone.

Unescaping a double-encoded payload

If a log shows JSON wrapped in quotes with \" everywhere, the payload was stringified twice. Unescape it once here, then paste the result into the formatter.

Questions

Do I include the surrounding quotes?

For escaping, no — paste the raw text; the result is what goes between the quotes. For unescaping, quotes are optional.

Is this the same as URL encoding?

No. URL encoding uses %XX sequences for a different purpose. Use the URL encoder for query strings.

Related tools