Why use this escaper
Three modes
Escape (strip outer quotes), Escape with quotes (full JSON string), or Unescape (parse JSON string escapes back to raw text). Switch on the fly.
All escape sequences
Handles \", \\, \n, \r, \t, \b, \f, and \uXXXX Unicode escapes — the full JSON spec.
Safe for any input
Uses native JSON.stringify and JSON.parse for 100% spec compliance. No regex hacks, no edge cases.
Conversion explained
1. Take input
Your raw text is treated as a string. No parsing assumptions are made.
2. Transform
For escape, the input is wrapped in a JSON string and the outer quotes are stripped (or kept, in "escape-full" mode). For unescape, the input is parsed as a JSON string.
3. Output
The result is displayed as plain text, ready to copy or download. No formatting applied — what you see is what you get.
JSON String Escape / Unescape — frequently asked questions
What's the difference between "Escape" and "Escape (with quotes)"?
Escape strips the outer double quotes — useful when you want to embed the string inside another JSON value. Escape with quotes keeps them — useful when you want a complete JSON string literal you can paste into a .json file.
What does "Unescape" do?
It takes a JSON-escaped string (with \n, \t, \", \uXXXX, etc.) and returns the raw text those escapes represent. For example, Hello\nWorld becomes "Hello" followed by a newline followed by "World".
Does this handle Unicode?
Yes. Both directions handle \uXXXX Unicode escapes. When escaping, non-ASCII characters may be left as-is or escaped depending on the browser's JSON.stringify implementation. When unescaping, \uXXXX is converted to the corresponding Unicode character.
Can this be used for HTML escaping?
No — JSON escaping is different from HTML escaping. JSON escapes < and & as literal characters (no escape needed), while HTML requires < and &. Use a dedicated HTML escaper for HTML content.
You might also like
JSON to Base64
Encode/decode JSON as Base64
JSON Minifier
Compress JSON to minimum size
JSON Beautifier
Pretty-print JSON with syntax highlighting
JSON Validator
Validate JSON syntax with detailed error messages
JSON Formatter
Format and beautify JSON with custom indentation
JSON Repair
Fix malformed JSON automatically