Json Escape
Result
| Result |
|---|
Share on Social Media:
JSON Escape & Unescape — Put Anything Inside a JSON String Safely
Embedding a code snippet, an HTML fragment, or a multiline message inside JSON by hand almost always breaks: the first raw quote or newline kills the parse. This free tool escapes any text into a valid JSON string literal — and unescapes JSON strings back to readable text — instantly in your browser. No signup.
The Escape Table
| Character | Escaped | Character | Escaped |
|---|---|---|---|
| " (quote) | \" | newline | \n |
| \ (backslash) | \\ | tab | \t |
| carriage return | \r | backspace | \b |
| form feed | \f | other control chars | \u00XX |
Where This Saves the Day
- API testing — paste a multiline email body or HTML template into a curl/Postman JSON payload without hand-escaping every quote.
- Config files — embed regex patterns (full of backslashes) into JSON settings; each literal \ must become \\, which humans reliably get wrong.
- Log analysis — unescape stack traces stored as JSON string values back into readable multi-line form.
- Code generation — turn file contents into string constants for JSON-based fixtures and snapshots.
Double-Escaping: The Classic Bug
Escaping already-escaped text turns \n into \\n — which unescapes back to a literal backslash-n, not a newline. If your output shows \n as visible characters instead of line breaks, it was escaped twice somewhere in the pipeline. The unescape mode here is the quickest way to diagnose how many layers deep a string is wrapped.
Free and Private
All conversion happens locally — tokens, templates, and code never leave your device.