About the JSON Escape / Unescape
Escape text so it can be placed safely inside a JSON string, or reverse the process to unescape it.
Key features
- Escape text for use inside a JSON string
- Unescape JSON string content back to plain text
- No surrounding quotes added, ready to paste between existing quotes
- Handles quotes, backslashes, tabs, newlines and Unicode escapes
- Raw line breaks in unescape mode are tolerated
- Instant, private
Escape and unescape JSON strings
When you hand-edit JSON and need to put text containing quotes, backslashes or line breaks into a string value, you must escape those characters or the JSON breaks. When you read such a value back, you unescape it to see the original text. This tool does both, without adding or requiring surrounding quotes.
Escape example
Text:
Path: C:\Users\ada
Say "hello" (tab)
Escaped:
Path: C:\\Users\\ada\nSay \"hello\"\t(tab)
Paste it between the quotes of a JSON value:
{ "note": "Path: C:\\Users\\ada\nSay \"hello\"\t(tab)" }
Escape reference
| Character | Escaped |
|---|---|
" | \" |
\ | \\ |
| Line feed | \n |
| Carriage return | \r |
| Tab | \t |
| Backspace / form feed | \b / \f |
| Other control characters | \u00XX |
Typical situations
- Windows paths in configs (
"C:\\Program Files\\App"). - Regular expressions in JSON, where every backslash must be doubled.
- HTML or SQL snippets stored in JSON configs or CMS fields.
- Multi-line messages in localization files.
- Reading log output where messages are shown escaped.
Regex in JSON: a quick tip
A regex like \d+\.\d+ must be written in JSON as "\\d+\\.\\d+". Escape mode does this for you.
Related tools
Need the quotes too? Use JSON Encode and JSON Decode. For whole JSON documents, see JSON Stringify.
How to use the JSON Escape / Unescape
- Paste your data into the input box, upload a file, or click Sample to try it out.
- Adjust the options above the editor if you need to (indentation, delimiter, and so on).
- The result appears instantly in the output panel. Any errors are shown with their line and column.
- Click Copy to copy the result, or Download to save it as a file.