DataFmt

JSON Escape / Unescape

Convert between raw text and JSON string literals without hand-escaping backslashes, quotes and newlines.

Drag & drop a file here, or click to upload
Options:

About this tool

Embedding text containing newlines or quotes inside JSON requires escaping: `"` becomes `\"`, newline becomes `\n`, tab becomes `\t` and so on. Reversing that escaping is equally tedious.

This tool performs one-click escape and unescape using the browser's JSON engine, so the output is always spec-compliant. Escaping produces a value you can paste straight into a JSON string without the surrounding quotes.

How to use

  1. Paste raw text or a JSON string literal into the input.
  2. Click "Escape" or "Unescape".
  3. The result appears on the right.
  4. If unescape fails, check the input is a valid JSON string fragment.

Use cases

Notes

Frequently Asked Questions

Does the escaped output include surrounding quotes?
No. That lets you paste the result inside an existing JSON string.
Can it handle Unicode characters?
Yes. Unicode is preserved by default; a `\uXXXX` mode can be added if needed.
What if unescape reports a parse error?
Check for unescaped backslashes or stray double quotes in the input.