JSON Escape/Unescape
Free online json escape/unescape for developers. Escape/unescape special chars in JSON. Fast and private.
Embed this tool
Copy and paste the code below into your website to embed this tool for free. An attribution link to The Util Box is required.
<iframe src="https://www.theutilbox.org/embed/json-escape-unescape" width="600" height="500" frameborder="0" style="border: none; max-width: 100%;" title="Free JSON Escape/Unescape tool from The Util Box"></iframe> <!-- Free tool by The Util Box — https://www.theutilbox.org/tools/json-escape-unescape --> <a href="https://www.theutilbox.org/tools/json-escape-unescape">JSON Escape/Unescape by The Util Box</a>
Frequently Asked Questions about JSON Escape/Unescape
JSON Escape & Unescape — Escape a String for a JSON Payload
This JSON escape and unescape tool works in both directions. In Escape mode it takes plain text and produces the escaped form you would paste inside a JSON string value. In Unescape mode it takes an escaped string and gives you the readable text back.
It exists because the escaping rules for JSON strings are strict enough to trip people up: a quote, a backslash, a newline and a tab all have to be written as two-character sequences, and getting one wrong makes an entire API request fail to parse.
How the Escaping Works
The escape is done by taking the whole text as one JSON string, serialising it, and then removing the outer quotes. That means it applies exactly the rules a JSON parser would apply, rather than a hand-rolled set of replacements that might miss a case.
| Character | Escaped as |
|---|---|
| " | \" |
| \\ | |
| newline | \n |
| tab | \t |
| carriage return | \r |
| backspace / form feed | \b / \f |
Unescaping works in the opposite direction: your input is wrapped in double quotes and parsed as a JSON string. If the input is malformed, the browser's own parse error appears in a red panel rather than failing silently.
Limits Worth Knowing
- This handles a string body, not a whole document. The output is the inside of a JSON string value — if you paste it into a payload, you still need the surrounding quotes.
- Unescape expects properly escaped input. Because it wraps your text in
double quotes, an unescaped
"inside the input breaks the parse. That is the correct behaviour, but it means you cannot feed it raw text and expect it to work. - Non-ASCII characters are left as they are. JSON permits them directly, so accented letters and emoji pass through unchanged rather than becoming \u escapes.
- It is not an XML or HTML escaper. The rules differ, so use the XML Escape/Unescape or HTML Entity Encoder for those formats.
Related Developer Tools
- XML Escape/Unescape — the same job with the XML entity rules.
- HTML Entity Encoder — for the HTML character set.
- JSON Formatter — pretty-print the document your escaped string belongs in.
- JSON Minifier — strip the whitespace back out.
- JSON to YAML — convert the payload to a different format entirely.
- URL Encoder — percent-encoding for a query string rather than a JSON body.
- Code Minifier — the whole-document version of the same idea.
Everything runs in your browser, so the text you are escaping is never uploaded.