Skip to content
jsonforge.app

JSON Escape / Unescape

Escape raw text into a JSON string literal, or unescape one back to plain text.

Input

Loading editor…

Escaped output

Result will appear here.

What is JSON Escape / Unescape?

A JSON string escaper/unescaper converts raw, multi-line text into a single-line JSON string literal — replacing characters that JSON's string syntax forbids or treats specially (double quotes, backslashes, newlines, tabs, and other control characters) with their backslash-escaped equivalents (\", \\, \n, \t, and \u00XX for other control codes). This is exactly what JSON.stringify() does to a string value, but exposed as a standalone tool so you can escape text that isn't attached to any larger object — useful when you're hand-writing a JSON payload, embedding a code snippet or log line inside a config file's string field, or debugging why a string with a literal quote in it broke a JSON parser. A common real-world case is double-encoded JSON: a webhook payload, GraphQL variable, or log field where an entire JSON document is itself stored as the string value of another JSON field (`"data": "{\\"id\\":1}"`) — pasting the inner document's raw text into Escape mode produces exactly that wrapped string, without hand-escaping every quote in it. Unescaping does the reverse: given an escaped string (with or without its surrounding double quotes), it decodes the escape sequences back into the original raw text, and the two directions round-trip losslessly for any input, including accented letters, emoji, and other non-Latin Unicode.

How to use JSON Escape / Unescape

  1. Switch to the "Escape" tab, then type or paste the raw text you want to embed as a JSON string value.
  2. The escaped, JSON-safe version appears instantly on the right, ready to paste inside a JSON document.
  3. Switch to "Unescape" to go the other way — paste an escaped string (quoted or not) and get the original text back.
  4. Use the copy button to grab the result without needing to select it manually.

Examples

Escaping a multi-line snippet

Input

Line one Say "hello"

Output

"Line one\nSay \"hello\""

Unescaping back to raw text

Input

"a\tb\\c"

Output

a b\c

Double-encoding a JSON document as a string field

Input

{"id":1,"active":true}

Output

"{\"id\":1,\"active\":true}"

Common mistakes

  • Pasting already-escaped text into Escape mode again, which double-escapes every backslash.
  • Forgetting that a literal backslash in your source text must itself become \\ — a single \ before an unsupported letter is invalid JSON.
  • Assuming Unicode characters need \u-escaping — they don't; only control characters and " / \ require it in standard JSON.
  • Typing text that already has its own surrounding quotes (like "hello") into Escape mode expecting them to become the JSON delimiters — every character you type is treated as literal content, so those quotes get escaped too and a fresh pair is added around the whole result.
  • Leaving the field blank or whitespace-only and expecting an empty JSON string ("") back — both modes treat empty or whitespace-only input as no input at all and report an error instead of returning "".

Why use this tool

  • Runs entirely in your browser — no text you escape or unescape is ever sent to a server.
  • Accepts escaped input with or without surrounding quotes, so you don't have to manually add them before unescaping.
  • Faster than manually hand-escaping quotes and newlines when embedding a snippet inside a JSON config or payload.
  • Built directly on JSON.stringify()/JSON.parse(), so the escaped output is guaranteed valid JSON rather than an approximation from a custom regex-based escaper.
  • Handles the double-encoded-JSON case — a JSON document embedded as a string value inside another JSON document — without hand-escaping every quote in the inner document one at a time.

Frequently asked questions