JSON String Escape and Unescape
Paste text and choose Escape to get a version that is safe inside a JSON string, or paste escaped content and choose Unescape to read the original text.
Use the tool
Loading the tool…
About JSON String Escape and Unescape
Convert text into a JSON string, with the special characters escaped, or convert a JSON string back into plain text. For escaping, you can add quotation marks around the result, and write non-ASCII and control characters as \uXXXX codes.
Worked example
Escape the text `He said "hi"`. The tool shows the JSON string with the quotation marks escaped.
Limits
Use the escaped string only where JSON is expected. Check the result in the system that will read it.
How to use JSON String Escape and Unescape
- Paste your text.
- Choose Escape or Unescape.
- Copy the result. When escaping you can add quotation marks or write non-ASCII characters as \u codes.
Good to know
- Escaping turns " into \", a backslash into \\, line breaks into \n and control characters into \u codes.
- Unescape accepts the content with or without the surrounding quotes. Spaces inside it are kept.
- If the escaped text is not valid, for example a stray quote or a bad \x escape, the tool says so instead of guessing.
- It handles one string at a time. To format a whole JSON document, use the JSON Formatter.
Frequently asked questions
Why does my escaped text have \n in it?
A real line break cannot appear inside a JSON string, so it is written as the two characters \n.
Can it escape a whole JSON file?
It treats whatever you paste as one string. Use the JSON Formatter for documents.
Is anything I type saved or sent?
No. The work happens in your browser on this page, and nothing is stored or sent to us.