JSON Escape / Unescape
Make any text safe to put inside a JSON string, and back again.
How to use the JSON Escape / Unescape
- Paste text to escape, or an escaped string to read.
- The direction is detected automatically, or choose it yourself.
- Optionally add surrounding quotes or escape every non-ASCII character.
- Copy the result.
Examples
About this tool
Inside a JSON string, some characters cannot appear as they are. Double quotes would end the string early, backslashes start escape sequences, and line breaks and tabs must be written as \n and \t. Pasting a message, an SQL query or a file path straight into JSON therefore breaks it. Escaping converts the text into a form that sits safely between the quotes.
The reverse is just as common: logs, API responses and configuration files often show strings full of \n, \" and \u codes that are hard to read. Unescaping turns them back into the original text with real line breaks and characters, and if an escape is invalid you are told which one.
The ASCII option writes every accented letter, symbol and emoji as a \u code. The JSON stays valid either way, but this helps with old systems and files that mishandle UTF-8. The two invisible line-separator characters that break JavaScript are always escaped.
Frequently asked questions
Which characters need escaping in JSON?
Double quotes, backslashes and control characters such as line breaks, tabs and carriage returns. Everything else, including accented letters and emoji, is allowed as it is in UTF-8 JSON.
Do I need to escape forward slashes?
No. \/ is allowed but optional. Some tools escape it to make embedding JSON in HTML script tags safer; this tool leaves slashes alone.
How do I put a line break in a JSON string?
Write it as \n. Paste your multi-line text here and every line break is converted for you.
Is my text kept or sent anywhere?
No. Escaping and unescaping happen in your browser and nothing is uploaded.