JSON Escape / Unescape
Convert plain text into a JSON-safe escaped string, or unescape a JSON-encoded string back to plain text. Handles quotes, backslashes, newlines, tabs, unicode, and control characters.
Output appears hereAbout JSON Escape / Unescape
JSON string escaping is needed anywhere you want to embed a string containing special characters (quotes, backslashes, newlines, control characters) inside a JSON structure. This tool handles both directions β Escape converts plain text to a JSON-safe string, Unescape reverses it. It uses JavaScript's native JSON.stringify/parse under the hood, so escape rules match the JSON specification exactly.
Common uses: preparing multi-line strings for a JSON config file, escaping a user-supplied error message to log as JSON, unescaping a JSON string from a log file to read the original content, and debugging over-escaped strings from API responses. Runs client-side; safe for sensitive strings.
How to Use
Choose Escape to convert plain text into an escaped JSON string (quotes and backslashes get \-prefixed, newlines become \n, etc.).
Choose Unescape to reverse the process β convert \n back to actual newlines, etc.
Paste your string; the result appears instantly.
Useful for embedding user text in JSON payloads, storing multi-line strings in a JSON config, or debugging escaped strings from log files.
Frequently Asked Questions
What characters need to be escaped in JSON?
Six characters MUST be escaped in JSON strings: double-quote ("), backslash (\), backspace, form-feed, newline (\n), carriage-return (\r), and tab (\t). Control characters (U+0000 through U+001F) must be escaped as \uXXXX unicode sequences.
Why doesn't JavaScript's JSON.stringify work directly on a plain string?
JSON.stringify wraps strings in double quotes and produces a valid JSON string literal. If you want just the escaped characters WITHOUT the surrounding quotes (e.g., to embed the string inside a larger JSON template), you need to slice off the quotes β which is what this tool does.
Are single quotes escaped?
No β JSON strings use double quotes exclusively, so single quotes inside the string do not need escaping. However, if you are embedding the escaped string in JavaScript source code with single-quote delimiters, YOU need to escape single quotes separately.
Is this the same as URL encoding?
No. JSON escaping handles JSON-specific characters (quotes, backslash, control chars). URL encoding (percent-encoding) handles URL-unsafe characters. They're different transformations for different transport formats. Use the URL Encoder/Decoder tool for URL-safe encoding.