JSON Escape & Unescape
Escape text or JSON into a JSON string, or unescape a backslash-filled string back to readable, pretty-printed JSON.
Runs in your browser. Nothing is uploaded.
How to use the JSON Escape & Unescape
- Choose Escape to turn text or JSON into a safe JSON string, or Unescape to turn an escaped string back into readable text.
- Paste into the left box, or press Load example for a sample of the current direction. The result appears on the right as you type.
- When escaping, tick Wrap in double quotes for a complete string literal, or Escape non-ASCII if the result must be plain ASCII.
- When unescaping, JSON results are pretty-printed automatically. Untick the option to keep the exact text.
- Press Swap ⇄ to send the result back as input in the other direction, for example to check that an escaped value round-trips.
Two directions of the same rule
A JSON string starts and ends with a double quote, so a quote inside the text would end it too early, and
a raw line break isn’t allowed at all. Escaping replaces each problem character with a backslash
sequence: " becomes \", a line break becomes \n, and a backslash becomes \\. Unescaping is the
reverse: it reads those sequences and gives you back the original characters. This tool does both, and
Swap moves the result across so you can go back and forth without copying.
When you need to escape
- Writing JSON by hand that contains quotes, Windows file paths or multi-line text
- Embedding a JSON document inside another JSON value, such as an event payload stored as a string field
- Putting text into code, since JavaScript, Java and C# string literals use very similar rules
- Building request bodies in API tools where a field must contain a quoted snippet
Pasting a whole JSON object turns it into one string with every inner quote escaped, sometimes called “stringifying”. The receiver then parses the value twice: once for the outer document and once for the inner string.
When you need to unescape
Escaped JSON turns up in log files, monitoring tools and message queues that record a body as a single
string, in APIs that return nested JSON as text, and in database columns that stored JSON with an extra
layer of encoding. Every key wrapped in \" is hard to read. Unescape it and, when the result is a JSON
object or array, it is pretty-printed straight away. For deeper inspection, open the result in the
JSON Formatter and use its Tree tab.
Options and errors
Wrap in double quotes adds the surrounding quotes, giving a complete string literal. Leave it off when
you paste into a string that already has quotes. Escape non-ASCII as \uXXXX rewrites characters
such as é, 日 or 😀 as Unicode escapes; emoji become two escapes (a surrogate pair), which is exactly
how JSON represents them.
When unescaping, every sequence is checked. Something JSON doesn’t allow, such as \q, an incomplete
\u12 or a bare double quote, is reported with its character position and a short fix. A common cause
is copying only part of a string.
Everything runs in your browser, so you can safely paste credentials, production logs and private data.
Frequently asked questions
Which characters does JSON escaping change?
Double quotes become \", backslashes become \\, and control characters such as line breaks and tabs become \n, \r and \t. Other control characters are written as \u followed by four hex digits. Everything else, including accented letters and emoji, can stay as it is.
Why does my JSON have backslashes everywhere?
It was stored as a string inside another JSON document or a log line, so every quote was escaped as \". Logging libraries, message queues and APIs that send a payload as a string field often do this. Switch to Unescape and paste it to get the original JSON back.
Do I need to include the surrounding quotes when unescaping?
No. The string is accepted with or without its outer double quotes, and leading or trailing spaces are ignored.
What if the text was escaped twice?
You'll see sequences like \\\" in the input. Unescape once, copy the result, and unescape it again. Each pass removes one level.
When should I escape non-ASCII characters?
Only when the system reading the JSON can't handle UTF-8, such as some older tools or files saved in a legacy encoding. Modern parsers read UTF-8 directly, so escaping every character just makes the text longer.
Is my text uploaded?
No. Escaping and unescaping happen in your browser, so tokens, logs and private data never leave your device.
Tutorials
How to read escaped JSON from a log file
Turn a log entry full of backslashes like {\"level\":\"error\"} into readable, formatted JSON you can inspect.
How to store a JSON object inside a JSON string field
Escape a JSON object so it fits inside a string field of another JSON document, such as an event payload or a settings value.