JSON Escape / Unescape
Turn text into a JSON string literal, or read an escaped string from a log back as plain text
Input
Output
Paste your input on the left and the result shows up here.
Or drop a file on this box, , or .
What is JSON Escape / Unescape?
Ever needed to drop a chunk of text into a JSON string, or read an escaped string out of a log? This tool does both. Escape mode turns your text into a JSON string literal: quotes become \", newlines \n, tabs \t, and the whole thing is wrapped in double quotes. Unescape mode turns it back into plain text.
Escape mode uses the same rules as JSON.stringify, which follows the RFC 8259 JSON specification and the ECMA-404 standard. Characters like é or 🔥 are valid in JSON as they are, so by default they stay readable; tick Escape non-ASCII as \uXXXX if the string has to survive an ASCII-only system. Unescape mode accepts a quoted JSON string, or escaped text without the outer quotes, like {\"sku\":\"SKU-101\"} copied from a log.
A quick way to trust the result: drop it into a JSON document as a value, such as {"note": <result>}, and parse it. If it parses, the escaping is right. The classic failure is a Windows path pasted by hand, like C:\Users\ava, where \U is not a legal JSON escape and the parser stops on that exact character.
How to Use JSON Escape / Unescape
The one decision that matters is the direction. Pick it first, because the Sample button and the output both follow the mode you are in.
Choose Escape or Unescape Mode
Use the Mode toggle above the editors. Escape turns text into a JSON string literal (quotes, newlines and tabs become \", \n, \t). Unescape turns it back. Example input for escape mode:
Plan: "Unlimited 5G"
Data: 45.2GB active Output becomes: "Plan: \"Unlimited 5G\"\nData: 45.2GB\tactive", quotes included, ready to paste as a JSON value per RFC 8259.
Paste, Upload, or Load Sample
Paste the raw text (a SQL query, an error message, a chunk of HTML) into the input pane, or let Upload read a .json or .txt file into it. Sample gives you a two-line greeting in escape mode and the already-escaped version in unescape mode. The output follows every keystroke, and both panes show plain text, so a stray \t is visible rather than rendered.
Copy or Download
In escape mode the output already carries its surrounding double quotes, so it can be pasted straight in as a value: "message": followed by the copied text. Copy grabs it, Download saves escaped.txt or unescaped.txt depending on the mode, and Clear resets the input.
When You'd Actually Use This
API Development
Building a JSON request body by hand, with a customer note that contains quotes and line breaks? Escape the note here and paste it in as the value. For real user input in code, let your JSON library do the escaping; this is for one-off payloads, fixtures and curl commands.
Data Processing
Unescape JSON strings from API responses or database exports. Convert escaped strings back to readable text for display or further processing.
String Encoding
Prepare strings for JSON encoding. Escape special characters before using JSON.stringify() or when building JSON manually.
Debugging
Debug JSON parsing errors. Unescape strings to see what they actually contain, or escape strings to see how they'll appear in JSON.
Common Questions
Is my data stored?
No. Escape mode is JSON.stringify and unescape mode is a JSON parse plus a small fallback for unquoted text, all running in this tab. Nothing is sent or logged.
What characters get escaped?
Double quotes (\"), backslashes (\\), newlines (\n), tabs (\t), carriage returns (\r), and the other control characters below U+0020. Non-ASCII characters like é or emoji are left as-is unless you tick Escape non-ASCII as \uXXXX.
What's the difference between escape and unescape?
Escape converts special characters to escape sequences (like " becomes \"). Unescape converts escape sequences back to normal characters (like \" becomes ").
Does it work with JSON objects?
Escape mode treats whatever you paste as one plain string, so an object comes out as a quoted string with its quotes escaped, which is what you want when embedding JSON inside JSON. In Unescape mode, a valid JSON object or number is shown unchanged, since there's no string to unescape; escaped text like {\"a\":1} is unescaped to {"a":1}. If the text you unescaped turns out to be a JSON object or an array of objects, the JSON parser online shows it as a table, which is easier to scan than one long line.
Can I escape Unicode characters?
Yes. Tick Escape non-ASCII as \uXXXX in escape mode and every character outside ASCII becomes a \uXXXX sequence; emoji become a surrogate pair like \ud83d\udd25. In unescape mode, \uXXXX sequences are always turned back into the characters they stand for.
What if I unescape invalid escape sequences?
Unknown escapes like \q are left as they are, and the rest of the text is still converted. A broken quoted string (say, one with an unescaped quote in the middle) is handled the same way: the backslash escapes are undone in place instead of failing.
Other JSON Tools You Might Need
Once the string is escaped it usually lands inside a bigger document. To check that document, pretty-print it, repair it, or turn a whole text blob into JSON, try these: