JSON Escape / Unescape
Processed Client SideTurn escaped, stringified JSON back into clean formatted JSON — or escape JSON into a string literal for embedding.
Bookmark this tool now — skip the search next time you need it.
About JSON Escape / Unescape
This tool runs entirely in your browser. Whatever you paste is processed on your own device and is never uploaded, logged, or sent to any server.
The JSON Escape / Unescape tool moves JSON between its readable form and its escaped string form. Unescape takes a blob full of backslashes — the kind that turns up in a log line, an error message, or a field that stores JSON inside JSON — and gives you back clean, pretty-printed JSON. Escape does the reverse: it minifies your JSON and wraps it as a single-line string literal you can paste into another JSON document, a shell command, or a source-code constant. Unescape is deliberately forgiving, accepting a proper quoted literal, a bare fragment with escapes and real newlines, or JSON that was never escaped at all.
Key features
- Two modes — Unescape turns an escaped blob into readable JSON, Escape turns JSON into a string literal
- Unescape recognises three shapes: a properly quoted string literal, a bare fragment with backslash escapes, and plain JSON that needs no unescaping
- Pretty-prints the unescaped result with 2 spaces, 4 spaces, or tabs when the content turns out to be JSON
- Falls back to plain text output when the unescaped content is not JSON, instead of throwing an error
- Escape mode minifies valid JSON first, so the literal it produces is as short as possible
- Escapes and unescapes through the browser’s own JSON engine, so \n, \t, \", \\ and \uXXXX are all handled exactly as the spec requires
- A badge tells you what you got back — Formatted JSON, Unescaped text, or Escaped — plus a line count
- Syntax highlighting on the input and on formatted JSON output
- Fully client-side, so escaped payloads pulled out of production logs stay on your machine
How to use it
- Choose the mode: Unescape to clean up an escaped blob, Escape to produce a string literal.
- Paste your content into the input pane — in Unescape mode the surrounding quotes are optional.
- In Unescape mode, pick the indentation you want for the formatted result.
- Check the badge on the output: Formatted JSON means the content parsed, Unescaped means it was text rather than JSON.
- Copy the output.
Tips & common mistakes
- Escaped JSON usually means something was serialised twice — JSON.stringify called on a value that was already a JSON string. Unescaping shows you the payload; fixing the double call at the source is the real repair.
- An API that returns "{\"ok\":true}" is returning a string, not an object. Your client has to parse it a second time, and this tool is the quickest way to read what that string actually contains.
- Paste log lines exactly as you copied them. The fallback handles fragments that lost their surrounding quotes, and real newlines or tabs in the middle are converted rather than rejected.
- Escape mode minifies first, so the literal it produces is compact by design. If you need the escaped form of an already pretty-printed document, escape the text as-is by making it something the parser rejects — or use the Minifier’s “Escape as string” toggle for the compact route.
- \uXXXX escapes are decoded back into real characters on unescape, so accented text and emoji come out readable rather than as codepoints.
- Single quotes are never valid in JSON. A blob using them is a JavaScript object literal or a Python dict, and it needs converting rather than unescaping.
- If unescaping fails, the usual culprit is a fragment cut mid-escape — a trailing lone backslash, or a copy that stopped inside a \uXXXX sequence.