What Is JSON Escaping?
JSON escaping ensures that special characters in a string value do not break the JSON structure. In JSON, strings are delimited by double quotes. If the string contains a double quote, it must be escaped as \". Similarly, backslashes become \\, newlines become \n, and tabs become \t. Control characters and some Unicode characters are represented as \uXXXX where XXXX is the hexadecimal code point.
This process is essential when manually constructing JSON, embedding user input, or debugging JSON parsing issues. Most programming languages handle escaping automatically via JSON serialization libraries.
How to Use This JSON Escape Tool
Select Escape or Unescape mode. In Escape mode, paste your raw text and click Escape. The tool converts quotes, backslashes, newlines, tabs, and control characters to their JSON escape sequences. You'll see the character count before and after, plus a preview of how the string would appear inside a JSON value.
In Unescape mode, paste an escaped JSON string (e.g., from a JSON file or API response) and click Unescape. The tool reverses all escape sequences back to raw text. Use Copy to copy the result to your clipboard.
Common JSON Escape Sequences
\" — double quote \\ — backslash \n — newline (line feed) \r — carriage return \t — tab \b — backspace \f — form feed \uXXXX — Unicode character (4 hex digits)
Control characters (ASCII 0–31) are typically escaped as \uXXXX. For example, the null character (ASCII 0) becomes \u0000. This ensures the JSON string is valid and unambiguous.
Frequently Asked Questions
Related Tools
Explore More Tools
Find this tool useful? Buy us a coffee to keep DuskTools free and ad-light.