JSON Escape and Unescape
Put a block of text, HTML or a file path into JSON without breaking it, or turn an escaped string from a log or API response back into readable text.
How to escape a string for JSON
- 1Paste your text.
- 2Choose Escape, and whether to add the surrounding quotes.
- 3Copy the result into your JSON.
What's escaped
Double quotes become \", backslashes \\, line breaks \n, tabs \t, and other control characters \u escapes, exactly as JSON.stringify does. Everything else, including accented letters and emoji, is left as it is.
Unescaping
Paste an escaped string with or without its surrounding quotes. Real line breaks are read as \n, so a string copied across several lines still works.
JavaScript too
An escaped JSON string is also a valid JavaScript string, so the result works in code as well.
Frequently asked questions
- Is my data uploaded?
- No. The conversion runs in your browser and nothing is sent anywhere.
- Why do I get an error when unescaping?
- Usually a lone backslash, or a \u not followed by four hex digits. Both are invalid in JSON strings.
- Can I escape a whole JSON document?
- Yes, which is how JSON is nested inside another JSON string. Unescape it to get the document back.