JSON Escape / Unescape
Input
Loading editor…
Output
Loading editor…

JSON Escape / Unescape

Paste any string and escape it for safe use inside a JSON value — or unescape a JSON-encoded string back to its original form. Handles quotes, newlines, tabs, backslashes, and all other special characters.

Escape
Makes any string safe to embed inside a JSON string value.
Unescape
Converts escaped sequences back to their original characters.
Instant
Click Escape or Unescape and get the result immediately.
Client-side
No data is uploaded. Everything runs in your browser.

What is JSON Escaping?

Inside a JSON string value, certain characters have special meaning and must be escaped with a backslash (\) to be treated as literal characters.

CharacterEscaped formMeaning
"\"Double quote
\\\Backslash
newline\nLine break
tab\tTab character
\r\rCarriage return
\b\bBackspace
\f\fForm feed

Escaping is needed when embedding a multi-line string inside a JSON value, storing Windows file paths (backslashes must be doubled), encoding one JSON document as a string value inside another, or building JSON payloads manually for curl or Postman.

Escaping Strings in curl and Postman

When building a JSON request body for curl or Postman, a value that contains double quotes will break the JSON unless escaped first.

Raw SQL query:

SELECT * FROM users WHERE name = "Alice" AND active = true

After escaping:

SELECT * FROM users WHERE name = \"Alice\" AND active = true

Full curl command:

curl -X POST https://api.example.com/query \
  -H "Content-Type: application/json" \
  -d '{"query": "SELECT * FROM users WHERE name = \"Alice\" AND active = true"}'

Double-Encoding — JSON Inside JSON

Storing a JSON document as a string value inside another JSON document requires escaping — every quote in the inner document must become \".

Inner JSON:

{"user": "Alice", "role": "admin"}

After escaping:

{\"user\": \"Alice\", \"role\": \"admin\"}

Outer document:

{
  "event": "login",
  "payload": "{\"user\": \"Alice\", \"role\": \"admin\"}"
}

This pattern shows up in AWS Lambda event payloads (where the HTTP body is a JSON string), database columns that store JSON as text, logging systems that serialize structured data into a string field, and webhook relay systems.

Windows File Paths

Windows file paths use backslashes as separators. A backslash inside a JSON string must be doubled (\\), so paths need special attention.

Original pathEscaped for JSON
C:\Users\Alice\DocumentsC:\\Users\\Alice\\Documents
\\server\share\file.txt\\\\server\\share\\file.txt

Paste the raw Windows path into the input, click Escape, and the output is ready to drop into a JSON config file or API payload. UNC paths (starting with \\) require four backslashes in JSON because each \\ represents one literal backslash.

Frequently Asked Questions

What is the difference between Escape and Unescape?

Escape converts a raw string into a form safe to use inside a JSON string value — special characters like quotes and newlines get backslash sequences. Unescape does the reverse: it reads those backslash sequences and restores the original characters.

When would I need to escape a string for JSON?

Common cases: embedding Windows file paths (backslashes must be doubled), storing multi-line text as a single JSON string value, building JSON payloads manually in curl or Postman, or encoding one JSON document as a string value inside another.

Does this wrap the output in quotes?

No. The output is the escaped content only, without surrounding quotes. This makes it easy to paste directly into an existing JSON string value.

Why does my JSON parse fail even after escaping?

The escaped output from this tool does not include the surrounding double quotes. When you paste it into a JSON document, make sure to wrap it in quotes: { "key": "<paste here>" }. If the value already has quotes around it and still fails, check for unescaped characters that were added after escaping.

What happens if I click Unescape on a string that isn't escaped?

If the input contains invalid escape sequences (e.g. a lone backslash), an error is shown. Plain text with no backslash sequences passes through unchanged — unescaping a string that was never escaped is a no-op.

Can I use this to unescape a JSON string copied from a JSON document?

Yes — but remove the surrounding double quotes first. Paste just the content between the quotes, not the quotes themselves, then click Unescape.

Is my data uploaded anywhere?

No. All escaping and unescaping runs locally in your browser using JavaScript's built-in JSON.stringify and JSON.parse. Nothing is sent to any server.