JSON Escape / Unescape

Escape or unescape JSON strings instantly. Convert raw text with quotes and special characters into valid JSON string syntax — free, browser-based.

What JSON Escape / Unescape Does

Escape mode takes raw text and returns a JSON-safe string with special characters replaced by their escape sequences — quotes become \", newlines become \n, backslashes become \\, and so on. Unescape mode reverses that: it takes an escaped JSON string value and returns the original human-readable text.

Who Uses This Tool

JSON Escape / Unescape is built for Backend developers, frontend developers, API integrators, data engineers, QA engineers debugging JSON payloads, developers hand-writing JSON config files. Whether you are processing data as part of an automated pipeline or need a quick one-off conversion in your browser, the tool requires no installation and no account — paste your input and get your result in seconds.

Primary Use Case

Escaping a multi-line or quote-containing string so it can be safely embedded as a value inside a JSON object without breaking the structure.

The Problem It Solves

Manually escaping strings for JSON embedding is error-prone — a single unescaped double quote, backslash, or newline silently breaks the entire JSON document and produces a parse error that can be hard to trace. Developers waste time counting backslashes or hunting invisible control characters. This tool eliminates that entirely: paste the raw string, get a guaranteed-valid escaped value in one step with no manual character hunting.

Example

Input
Hello "world"
Line 2
C:\Users\Admin
Output
Hello \"world\"\nLine 2\nC:\\Users\\Admin

When to Use This Tool

Use this tool when embedding text inside JSON payloads, debugging APIs, preparing configuration files, testing escaped responses, or working with serialized JSON data.

What to Do With the Output

They paste the escaped string directly into a JSON value field in a config file, API request body, or database record, or use the unescaped result to read the original content from a received JSON payload during debugging.

Common Mistakes to Avoid

Pasting an already-escaped string into escape mode double-escapes it — backslashes become \\\\ and quotes become \\\", which is a common source of corrupted output. Unescape mode expects only the inner string value, not the surrounding quotes — wrapping the input in "..." before pasting will cause a parse failure. Control characters like tab (\t) and carriage return (\r) are escaped correctly by the tool but are invisible in the input field, making it unclear why the output changed. Not all JSON parsers handle every Unicode escape sequence identically — if the destination system is strict, verify edge cases like \u0000 null characters separately.

How It Works

Escape mode passes the raw input string to JSON.stringify() and strips the surrounding quotes from the result using .slice(1, -1) — this leverages the browser's native JSON serializer to produce a spec-compliant escaped string. Unescape mode wraps the input in double quotes, pre-escapes any existing backslashes and quote characters to prevent parse collisions, then passes the constructed string to JSON.parse() — which returns the decoded original value. Both paths run entirely in the browser with no external dependencies.

Pro Tip

Unescape mode can decode double-encoded JSON strings — strings that have been through JSON.stringify() twice and contain literals like \\\". Paste the inner escaped value and run unescape once to recover the first layer, then again to recover the original text, rather than manually stripping backslash pairs.

Also Known As

JSON Escape / Unescape is also commonly referred to as JSON string escape, JSON encode string, JSON unescape tool, escape quotes for JSON, JSON escape characters, JSON backslash escape, json newline escape, json escape special characters online, json string decoder. All of these terms describe the same conversion — no matter what you call it, this tool handles it.

Frequently Asked Questions

Double quotes ("), backslashes (\), and control characters including newline (\n), carriage return (\r), tab (\t), and other non-printable characters below Unicode code point U+0020.
No. Paste only the inner string value without the enclosing " characters. The tool adds them internally for parsing — including them in your input will cause a parse error.
You are likely escaping an already-escaped string. If your input contains \" or \n as literal escape sequences rather than actual quote or newline characters, run unescape first to decode it, then re-escape if needed.
No. It operates only on string values — it escapes or unescapes the content of a single string field. To validate a complete JSON document, use a dedicated JSON validator.
No. JSON escaping and URL encoding are different formats with different character sets and escape syntaxes. JSON escaping is for embedding strings inside JSON documents; URL encoding is for transmitting data in query strings or form bodies.
Yes. JSON.stringify() preserves Unicode characters as-is when they are printable. Non-printable Unicode control characters are converted to \uXXXX escape sequences automatically.