\", \\, \n, and \uXXXX, back to characters. Escape performs the reverse operation on the input text. Paste text in the input panel, choose Escape or Unescape, and copy the resulting string from the output panel. Auto mode is a convenience heuristic, so select the direction explicitly for ambiguous input. Processing runs in your browser, and the input is also retained in this browser's local storage. For the grammar and security boundaries, read the JSON escaping guide and the JSON definition.- Paste your raw JSON string into the input text area.
- Click the 'Escape' button to convert special characters into their escaped sequences. The result is a single, safe string.
- To reverse the process, paste an escaped string and click the 'Unescape' button.
- You can also format or compress the JSON before or after escaping/unescaping.
- Use the 'Copy' button to grab the result, or 'Load Example' to see how it works.
What is the difference between JSON escape and JSON.stringify()?
Escaping represents syntax-sensitive characters inside a JSON string. JSON.stringify() serializes a JavaScript value and, for a string value, returns the complete JSON string literal including its surrounding quotes. This tool's Escape output is the string body without those outer quotes; use your programming language's serializer when building a JSON document.
How do I unescape a JSON string safely?
Choose Unescape, paste one valid escaped string body, and inspect the output. In application code, parse a complete JSON string literal with a standard JSON parser instead of replacing backslashes manually. Reject malformed input rather than guessing how to repair it.
Why does double-escaped JSON contain so many backslashes?
Each string layer must escape the backslashes and quotes used by the previous layer. Remove one layer at a time and stop when you reach the value expected by the receiving protocol. Repeatedly unescaping unknown input can change valid data.
How are Unicode characters handled?
JSON may contain Unicode characters directly. A BMP code point can also use a \uXXXX escape, while a non-BMP character may be represented by a UTF-16 surrogate pair. Escape spelling does not add encryption or validation, and malformed surrogate handling can vary by parser.
When should I avoid manual JSON replacement?
Avoid manual replacement when creating or parsing JSON, especially for APIs, nested payloads, Unicode, or untrusted input. Replacement order can double-escape content or miss control characters. Use a standard serializer/parser, then apply schema validation and the security controls required by the next context.
JSON Escaping Explained【2026】: Strings, Unicode, Nesting, and Contexts
Learn the JSON string grammar, required escapes, Unicode and surrogate pairs, nested JSON, and safe serialization in JavaScript, Python, Go, and Java. Distinguish JSON escaping from URL encoding, Base64, HTML escaping, SQL parameters, and security validation.
JSON Formatting and Minification【2026】: Readability, Transport, and Canonicalization
Learn when to pretty-print, minify, compress, or canonicalize JSON. Separate whitespace changes from gzip/Brotli transport compression, preserve numeric and Unicode semantics, avoid accidental key-order or secret leaks, and build reproducible validation workflows.