Escape and Unescape JSON Strings Reliably
JSON has exactly one string syntax, and hand-editing rarely gets it right: a stray quote breaks the document, a real newline is illegal inside a string, a Windows path full of backslashes turns into escape-sequence soup. This free tool converts in both directions. Escape mode takes plain text — multi-line content, quotes, tabs, special characters — and produces a string safe to drop between quotes in any JSON document. Unescape mode reverses the process, turning \n, \", \\, \t, and \uXXXX sequences back into the readable text they encode. Both directions use the same parsing rules as JSON itself, and everything runs in your browser.
What Escaping Changes
JSON strings may not contain raw double quotes, backslashes, or control characters, so escaping replaces each with its sequence: quotes become \", backslashes become \\, newlines \n, carriage returns \r, tabs \t, and other control characters become \u escapes like \u0001. Ordinary letters, digits, punctuation, and Unicode text pass through unchanged — escaping touches only what JSON forbids. The output is the exact content of a valid JSON string; enable the wrapping option to receive it with surrounding quotes, ready to paste as a complete value.
When You Need Escape Mode
Escape mode earns its keep wherever JSON is written by hand or assembled from text. Embedding an error message, SQL query, or HTML fragment into a config file or API request body. Building test fixtures that contain multi-line strings. Pasting a file path like C:\\Users\\name into a settings file. Putting a JSON document inside another JSON document — a common and confusing case where the inner document must be escaped wholesale. In each case the tool guarantees the result parses, eliminating the quote-counting that manual escaping demands.
When You Need Unescape Mode
Escaped strings are unreadable in proportion to how interesting they are: log entries arrive with payloads full of \n and \", API responses nest JSON inside JSON, and debugging means squinting through backslashes. Unescape mode decodes the sequences back to real characters — newlines become actual line breaks, \u00e9 becomes é — turning a wall of escapes into the original text. Paste the string with or without its surrounding quotes; the tool handles both and reports invalid escape sequences instead of guessing.
Double Escaping and How to Avoid It
The classic failure mode is escaping twice: text that already contains \n gets escaped again into \\n, and the consumer displays a literal backslash-n instead of a line break. It happens when two layers each escape — application code plus a templating system, or JSON embedded in JSON where the wrong layer was escaped. The symmetric design of this tool helps diagnose it: unescape once and inspect; if the text is still full of sequences, it was double escaped and one more unescape recovers the original. Escape exactly as many times as there are JSON layers, no more.
Edge Cases the Tool Handles
Forward slashes are left unescaped, since JSON permits both forms and bare slashes are more readable. Unicode beyond ASCII passes through as-is rather than being converted to \u sequences, keeping non-English text legible while remaining valid JSON. In unescape mode, surrounding quotes are detected and stripped automatically, and malformed input — an unterminated escape, a bad \u block — produces a clear error rather than corrupted output. The result of each mode is always valid input for the other, so round trips are lossless.
Privacy and Client-Side Processing
All conversion runs locally in your browser; payloads, logs, and config fragments are never uploaded, stored, or logged anywhere. That matters here more than for most tools, since escaped strings often contain API responses and internal data. The text is cleared from memory when you close the page, and the output statistics show the resulting length in characters.