JSON Escape & Unescape
Escape raw text as a JSON string or decode strict and nested JSON string literals
The result processed with strict JSON string rules will appear here.
About this tool
JSON Escape & Unescape uses the platform JSON parser and serializer to apply real JSON string-literal rules. Escape mode handles quotes, backslashes, tabs, newlines, control characters, and optional non-ASCII or HTML-sensitive escaping, with or without surrounding quotes. Unescape mode accepts a complete quoted JSON string or raw escape sequences, reports parse positions when available, and can decode up to five nested quoted-string layers. It intentionally does not parse or pretty-print complete JSON objects; use the JSON Formatter for document-level work.
Scenario Recipes
Embed a multiline message in an API fixture
Goal: Produce one valid JSON string without manual backslash mistakes
- Paste the raw multiline text in Escape mode and keep surrounding quotes enabled.
- Enable ASCII-only or HTML-safe output only when the consuming channel requires it.
- Insert the result as a JSON value, then validate the complete document with the JSON Formatter.
Result: A standards-compliant JSON string literal that preserves the intended text.
Frequently Asked Questions
How is JSON escaping different from URL or regex escaping?
JSON has its own quoted-string grammar for backslashes, quotes, controls, and Unicode; URL and regex rules solve different problems.
Can the result omit surrounding quotes?
Yes. Escape mode can return only the string contents, though the quoted form is the complete valid JSON value.
What does raw escape input mean?
It lets you enter sequences such as Line 1\nLine 2 without typing the outer JSON double quotes.
Can it decode a JSON string inside another JSON string?
Yes. Nested mode repeatedly decodes quoted string values up to five layers and stops before non-string JSON.
Does ASCII-only mode preserve emoji?
It represents non-ASCII UTF-16 code units as \uXXXX sequences, including surrogate pairs for emoji.
Is the text uploaded?
No. JSON parsing, serialization, nesting checks, and copying all happen locally.
Keep browsing