JSON Escape / Unescape

Encode text into a JSON string or decode it back.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

JSON escape and unescape

When you need to drop raw text — a multi-line message, a snippet containing quotes, a log line — into a JSON document, every special character has to be escaped first. This tool converts raw text into a valid JSON string body and decodes escaped strings back to plain text, using the browser’s own JSON engine so the result is spec-correct.

How it works

Escaping wraps your text with JSON.stringify and removes the outer quotes, leaving just the escaped body. Unescaping wraps your input in quotes and runs JSON.parse. Because both use the native engine, every rule of the JSON spec is honoured, including \uXXXX unicode escapes.

CharacterEscaped as
" (double quote)\"
\ (backslash)\\
newline\n
tab\t
carriage return\r
control / non-ASCII\uXXXX (where needed)

Example

Escaping the two-line text:

Hello "world"
Line two

produces the body:

Hello \"world\"\nLine two

Unescaping that body restores the original two lines exactly. Everything runs in your browser — nothing is uploaded.

Ad placeholder (rectangle)