JSON Escape / Unescape
Turn text, JSON or XML into a single JSON string literal (quotes, backslashes and line breaks escaped) — or unescape a stringified JSON value back to the original. Runs in your browser.
Suggested tools
About JSON Escape / Unescape
JSON Escape turns text, JSON or XML into a single JSON string literal: quotes and backslashes are escaped and line breaks become \n, so the content can be embedded as a value inside another JSON document, an environment variable or source code.
Unescape does the reverse — paste a stringified JSON value (for example from a log line or a database field) and get the original back. It runs entirely in your browser, so nothing you paste is uploaded.
How to use JSON Escape / Unescape
- Paste text to escape, or an escaped string to unescape.
- Press Escape or Unescape.
- Copy the result.
Key features
- Escape and Unescape on one page
- Valid JSON string literal with quotes
- Handles JSON, XML or any text
- Clear error for invalid escaped strings
Example
Two lines of text with quotes, turned into one JSON string literal.
Line one He said "hi"
"Line one\nHe said \"hi\""
When to use JSON Escape / Unescape
- Storing a JSON document as a string field inside another JSON payload.
- Putting multi-line text into a JSON config or environment variable.
- Reading double-encoded JSON from logs or message queues.
Tips and common problems
- If the unescaped result is still full of \", unescape it again.
- Escaped output includes the surrounding quotes, ready to paste as a value.
- For JavaScript, Java or C# string literals, use the language-specific escape tools.
Frequently asked questions
When JSON has to be stored as a string inside other JSON — for example a payload field, a message queue or a config value.
Escaping a text with this tool gives the same result as JSON.stringify on that string.
The JSON was stringified, maybe more than once. Unescape it, and repeat if it is still escaped.