/

JSON Escape / Unescape

Processed Client Side

Turn escaped, stringified JSON back into clean formatted JSON — or escape JSON into a string literal for embedding.

Input
Escaped JSONLength: 318Lines: 1Size: 318 BytesCursor: 1:1
Clean JSON
Formatted JSON23 lines
JSONLength: 363Lines: 23Size: 363 BytesCursor: 1:1

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

  1. Choose the mode: Unescape to clean up an escaped blob, Escape to produce a string literal.
  2. Paste your content into the input pane — in Unescape mode the surrounding quotes are optional.
  3. In Unescape mode, pick the indentation you want for the formatted result.
  4. Check the badge on the output: Formatted JSON means the content parsed, Unescaped means it was text rather than JSON.
  5. 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.

Related tools

Browse all 24 JSON tools

Frequently asked questions

10

Switch to Unescape mode, paste the escaped blob — with or without its surrounding quotes — and the clean, pretty-printed JSON appears on the right. Choose 2 spaces, 4 spaces, or tabs for the indentation.

Switch to Escape mode and paste your JSON. It is minified and returned as a single-line string literal with every internal quote escaped, ready to paste into another JSON document or a code constant.

Because the value was serialised twice — a JSON string was passed to a serializer that stringified it again. Your client has to parse it a second time, and this tool shows you what the inner payload contains.

All of the ones JSON defines: \" \\ \/ \b \f \n \r \t and \uXXXX. Escaping and unescaping both go through the browser’s own JSON engine rather than a hand-written regex.

No. If the input is a properly quoted string literal it is parsed as one; if it is a bare fragment with backslash escapes, that is handled too. Real newlines and tabs in the middle are converted rather than rejected.

You get the unescaped plain text and an “Unescaped” badge instead of an error. That is common with log lines, where the escaped payload is a message rather than a JSON document.

No. Everything runs in your browser, which matters here because escaped payloads are usually copied out of production logs and error reports.

Usually the fragment was cut mid-escape — a lone trailing backslash, or a copy that stopped inside a \uXXXX sequence. Copy a little more of the original line and try again.

Yes. \uXXXX sequences are decoded back into real characters on unescape, so accented text, CJK characters, and emoji come out readable instead of as codepoints.

The Minifier is about size — it strips whitespace and reports the bytes saved, with escaping as an optional extra. This tool is about form, converting in both directions between readable JSON and its escaped string representation.