Developer tool / 22

JSON String Escaper & Unescaper

Escape quote characters, newlines, and control characters for JSON string literals or unescape raw JSON string data.

JSON String Escaper & Unescaper: TOEA converts double quotes, backslashes, control codes, and newlines to/from valid JSON string escape sequences (\", \\, \n). Runs 100% locally in your browser with zero server file uploads.

Runs
In your browser
Cost
Free · no sign-up
Availability
Ready to use

What JSON escaping covers

Inside a JSON string only the double quote, the backslash, and control characters below U+0020 must be escaped, so \", \\, \n, \t, and \u0000-style codes are what you will see. Accented letters and emoji may stay as they are, since JSON is UTF-8. JSON has no \' escape and no single-quoted strings, which is why text copied from JavaScript source often fails to parse.

Double escaping and HTML pages

Seeing \\n or \\\" in a log usually means a value was escaped twice, often because a JSON document was stored as a string inside another JSON document. Unescape once, look at the result, and unescape again if it still has backslashes where there should be none.

Escaping for JSON does not make a value safe inside an HTML <script> block: a string containing </script> still ends the script early. Escape < as \u003c there, or put the data in a <script type="application/json"> element and read it with JSON.parse.

How to use it

  1. Paste raw text or an escaped JSON string.
  2. Choose Escape or Unescape mode.
  3. Copy the converted string result.

Privacy & limitations

All string escaping operations take place locally in your browser memory.

Related tools

Frequently asked questions

Why escape strings for JSON?

Unescaped quotes or line breaks inside JSON string values cause JSON syntax errors.

Free tool · runs in your browser · no account required