JSON Escape / Unescape
Escape raw text into a JSON-safe string, or unescape a JSON string back to plain text. Nothing leaves your browser.
What is JSON Escaping?
JSON strings must not contain raw double quotes, backslashes, or control characters. These must be escaped with a leading \. For example, a newline inside a JSON string must be written as \n, not a literal line break.
This tool uses JSON.stringify() for escaping and JSON.parse() for unescaping, so the output is always spec-compliant.
Common Use Cases
- Embedding a JSON payload as a string value inside another JSON document
- Reading log entries where the JSON was double-encoded
- Preparing strings for storage in JSON-based databases (Firestore, DynamoDB)
- Debugging API responses that return escaped JSON strings
- Generating test fixtures with embedded string data
Escape Sequences
\"— double quote\\— backslash\n— newline (LF)\r— carriage return (CR)\t— horizontal tab\uXXXX— any Unicode code point
Frequently Asked Questions
What does "Wrap in quotes" do?
When enabled in Escape mode, the output is wrapped in double quotes — making it a complete, valid JSON string literal (e.g. "hello\nworld"). Disable it to get only the inner escaped content, ready to paste between existing quotes.
Do I need surrounding quotes when unescaping?
No — the tool auto-detects them. Paste with or without the outer "…"quotes and it will work either way.
Why does unescape fail on my input?
The input contains an invalid escape sequence. Common mistakes: a lone backslash (\ not followed by a valid escape character), or a literal control character. Check the error message for the exact position.
What is the Swap button?
Swap moves the current output into the input and flips the mode — letting you round-trip quickly: escape then unescape to verify the result is identical to the original.