JSON Escape / Unescape Online
Escape special characters in JSON strings or unescape encoded sequences back to readable text with auto-detection and multiple modes.
Input
Output
How to Use
- Paste your text or escaped JSON string in the input panel.
- The tool auto-detects whether to escape or unescape. Override with the Direction dropdown.
- Choose the mode (JSON, JavaScript, or HTML) and scope (all chars, quotes only, or full Unicode).
- Copy the result or download it as a file.
When Do You Need JSON Escaping?
Embedding JSON in strings: When you store JSON as a string value inside another JSON document, all internal quotes and backslashes must be escaped. This is common in configuration files, database text columns, and message queues.
API debugging: API responses and webhook payloads sometimes contain doubly-escaped JSON. Unescaping reveals the original structured data for inspection.
Code generation: When generating source code that includes JSON string literals, you need properly escaped strings. JavaScript, Java, and C# each have slightly different escaping rules.
HTML embedding: When embedding JSON data in HTML attributes or script tags, HTML entity escaping prevents injection vulnerabilities and rendering issues.
Related Tools
- JSON to String Converter — convert valid JSON into language-specific string literals (JavaScript, Python, Java)
- JSON Pretty Print & Viewer — format and inspect JSON with tree view and repair modes
Frequently Asked Questions
What characters does JSON escaping handle?
Per RFC 8259, JSON requires escaping double quotes ("), backslashes (\), and control characters (newline \n, carriage return \r, tab \t, backspace \b, form feed \f). Any Unicode character can also be represented as \uXXXX.
What is the difference between JSON and JavaScript escaping?
JavaScript escaping includes everything JSON escaping does, plus it handles single quotes (\') and backticks (\`) which are used in JavaScript string literals and template literals.
What is HTML entity escaping?
HTML entity mode converts characters like <, >, &, and " into their HTML entity equivalents (<, >, &, "). This prevents XSS attacks and ensures proper HTML rendering when JSON data is embedded in HTML.
How does auto-detection work?
The tool scans the input for escape sequences (like \n, \", \u0041) or HTML entities (like &). If found, it suggests unescaping. If no escape sequences are detected, it suggests escaping.
What does "Full Unicode" scope do?
Full Unicode mode converts all non-ASCII characters (code points above 127) into \uXXXX escape sequences. This is useful when you need pure ASCII output for systems that do not support UTF-8.
Can this tool unescape doubly-escaped JSON?
Yes. If your input is doubly escaped (e.g., \\"name\\"), the tool will unescape one layer. Run it again to unescape the second layer. The pretty-print option attempts to format the final result as JSON.
How is this different from the JSON to String tool?
The JSON to String tool converts valid JSON into language-specific string literals (JavaScript, Python, Java assignments). This tool handles raw character escaping/unescaping per the JSON spec and accepts any text, not just valid JSON.