JSON Escape & Unescape
Escape plain text into a valid JSON string literal, decode an escaped literal back to readable text, and get a JavaScript-source-safe variant. Runs entirely in your browser.
Input
How it works
- Escape serializes the input with JSON.stringify: quotes, backslashes, newlines, tabs and control characters become the short \u-escapes that JSON requires, wrapped in double quotes.
- Unescape parses the literal back with JSON.parse, restoring the original text — handy for decoding API logs, CSV dumps, or generated payloads.
- The For JavaScript source row shows the same literal with U+2028 and U+2029 also escaped, so the string is safe to paste into older JS engines that reject those characters in source code.
- Byte counts (UTF-8) for input and output are shown under the result.
About JSON Escape & Unescape
Escaping is the price of putting arbitrary text inside a JSON document: quotes and backslashes must be marked, and control characters cannot appear literally. Getting the escaping wrong produces invalid JSON — a leading cause of broken configs, failed API calls, and corrupted import scripts.
This tool removes the guesswork. Escape raw text before embedding it in a config file, a request body, or a test fixture; unescape when you pull an escaped literal out of logs and want to read it. Both directions run locally, so sensitive payloads never leave your browser.