snaptools
\"
JSON Escape/Unescape error
⌃⏎ run · clear · / focus input
// about this tool

JSON Escape/Unescape Online

Updated 2026-07-09

Escape text for use inside JSON strings, or unescape a JSON string back to plain text — online and free. Switch direction with one click: Escape turns quotes, backslashes, newlines, and tabs into safe escape sequences, while Unescape reverses them. Everything runs in your browser, so nothing is uploaded.

Hand-writing JSON breaks the moment a value contains a quote or a backslash. This tool takes any text and makes it safe to drop into a JSON string (no surrounding quotes added), and turns escaped strings from logs or configs back into readable text — instantly, with one-click copy.

Unescape decodes the escape sequences in place. Paste a whole double-encoded log line — the kind where a message field hides an escaped JSON blob — and every \n becomes a real newline and every \" becomes a quote, so the buried payload becomes readable on its own lines instead of a wall of escapes. If the decoded text is itself valid JSON, it is pretty-printed for you.

// how to use

  1. 1 Choose Escape (text → JSON string) or Unescape (JSON string → text) in the toolbar.
  2. 2 Paste your content into the input panel.
  3. 3 Copy or download the result from the output panel.

// examples

Escape text for JSON
Input
He said "Hi" on line 1.\nDone.
Output
He said \\"Hi\\" on line 1.\\nDone.
Unescape a JSON string
Input
C:\\\\temp\\\\file.txt
Output
C:\\temp\\file.txt
Unescape an escaped JSON string
Input
{\"a\":1,\"b\":[2,3]}
Output
{
  "a": 1,
  "b": [
    2,
    3
  ]
}

// common uses

Embedding text or code inside a JSON payload Building JSON fixtures and API request bodies by hand Reading escaped strings from logs or config Fixing broken JSON caused by unescaped quotes

// faq

It converts characters that are special inside a JSON string — double quotes, backslashes, newlines, tabs, and other control characters — into their escape sequences (\\", \\\\, \\n, \\t) so the text can be safely embedded in a JSON value.
No. Escape returns just the escaped content so you can drop it straight into an existing JSON string. Add your own quotes around it when needed.
Both. You can paste a full JSON string (with surrounding quotes) or just the escaped inner content — either is unescaped back to plain text.
Yes. Paste a one-line log entry whose message contains an escaped JSON blob and Unescape turns every \\n into a real newline and every \\" into a quote in place — so the buried JSON becomes readable on its own lines instead of a wall of escapes. If the fully decoded text is itself valid JSON, it is pretty-printed. Unknown escapes are left untouched rather than rejected, so messy input never errors.
Unicode characters are left readable rather than turned into \\uXXXX sequences, which keeps the output compact and human-friendly while staying valid.
No — escaping and unescaping run in your browser, so nothing leaves your machine.

Use this via API

Get a free API key →
curl -X POST https://snaptools.dev/api/v1/tools/json-escape \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"He said \"Hi\" on line 1.\\nDone."}'
Esc
↑↓ navigate open Esc close