Escape and unescape JSON strings in your browser
To embed arbitrary text as a value in a JSON document, it has to become a valid JSON string literal — quoted, with every special character escaped. This tool turns raw text into that literal and decodes a literal back to plain text, so you can safely paste multi-line content into a JSON config, log line or API payload.
How it works
Escaping runs your text through the browser’s native JSON.stringify, which
escapes the special characters and wraps the whole value in double quotes.
Unescaping runs JSON.parse (adding the outer quotes first if you left them off),
turning the escapes back into the original characters.
| Character | Becomes |
|---|---|
" | \" |
\ | \\ |
| newline | \n |
| tab | \t |
| carriage return | \r |
| control / non-ASCII | \uXXXX |
The result is a complete literal including the surrounding quotes — unlike the companion JSON Escape tool, which returns only the body.
Example
Escaping this two-line text:
Path: C:\temp
Done
produces the literal:
"Path: C:\\temp\nDone"
Unescaping that literal restores the original two lines exactly. Everything runs locally in your browser — nothing is uploaded, which makes it safe for confidential text and snippets.