Logo JSON Parser Online

Escape and Unescape JSON Strings

Paste a string and click Escape to produce a JSON-safe version with special characters escaped — or click Unescape to strip escape sequences and recover the original text. Useful when embedding strings inside JSON payloads or extracting content from serialized data.

All JSON Tools

28 tools

Free, fast, runs in your browser. No login needed.

Made with ❤️ in India · © 2025 parsejsononline.com
INPUT
1
OUTPUT
1
✅ Ready
Characters: 0
Ctrl+Enter to run
What is this tool?

How to use

  1. Paste your string into the INPUT pane.
  2. Click Escape to convert it to a JSON string literal (with surrounding quotes and all special characters escaped).
  3. Or click Unescape to reverse the process — removing surrounding quotes and converting \" back to " and \\ back to \.
  4. Click Copy to use the output.

How it works

Escaping uses JSON.stringify(input). This is the correct and complete approach — it handles every character that must be escaped in a JSON string: double quotes (\"), backslashes (\\), newlines (\n), tabs (\t), carriage returns (\r), and all Unicode control characters. The output includes the surrounding double-quote characters, making it a valid JSON string literal you can paste directly into a JSON document.

Unescaping is a partial operation. The tool strips the surrounding "..." quotes, converts \" back to ", and converts \\ back to \. It does not convert other escape sequences: \n remains as the two characters backslash and n (not an actual newline), and \t, \r, \uXXXX, \b, \f are similarly left as literal text.

If you need full unescape including newlines and Unicode sequences, paste the escaped string into the JSON Formatter instead: wrap it in a JSON object like {"v": "your\nstring"}, format it, then copy the value. The formatter's JSON.parse() handles the complete escape specification.

Common use cases: escaping a string before inserting it as a value in a JSON template; unescaping a stringified JSON snippet that was double-serialized; preparing text for inclusion in a JSON configuration file.

FAQ

What characters does Escape handle?

All characters required by the JSON spec: double quotes, backslashes, newlines (\n), tabs (\t), carriage returns (\r), backspace (\b), form feed (\f), and Unicode control characters below U+0020. The output is a valid JSON string literal including surrounding double quotes.

Why does Unescape leave \n as backslash-n instead of a real newline?

The unescape direction only handles \" and \\ sequences. It does not process \n, \t, \r, or \uXXXX. For full unescape, wrap the string in {"v": "your escaped string"} and run it through the JSON Formatter, which uses JSON.parse() to handle the complete spec.

Why does the escaped output include double quotes?

Escape produces a valid JSON string literal — the surrounding double quotes are part of the JSON value representation. If you only want the escaped content without quotes, remove the first and last character from the output.

What is double-serialized JSON?

Sometimes JSON gets serialized twice — a JSON object is stringified, and then that string is stored as a value inside another JSON document. You get something like "{\"key\": 1}". Unescape once to get the inner JSON string, then format it as JSON.

Is my data sent anywhere?

No. Both escape and unescape run entirely in your browser.

Related tools

JSON FormatterFull unescape via JSON.parse() — handles all escape sequences. Base64 to/from JSONEncode or decode JSON as Base64. JSON Repair / FixFix malformed JSON including escape issues.