Tools

JSON Escape & Unescape

Escape text as a JSON string, or unescape \n and \"

How to escape text for JSON

  1. Paste the raw text: a multi-line message, HTML snippet, SQL query or Windows path.
  2. Press Escape. Double quotes become \", backslashes become \\, line breaks become \n, tabs \t, and other control characters are written as \u00XX.
  3. Keep Wrap in quotes ticked to get a complete JSON string literal you can drop into a document, or untick it for just the inner content.
  4. To read an escaped string, paste it and press Unescape. Surrounding quotes are optional.

Why JSON strings need escaping

Inside a JSON string, a raw double quote would end the string early and a raw newline is not allowed at all, so the document fails to parse. Escaping is needed whenever you put free text into JSON by hand: request bodies in Postman or curl, configuration values, test fixtures, LLM prompt payloads, or a prompt containing code.

Unescaping is the reverse problem: log files, API error messages and database exports often show JSON strings full of \n and \", which are hard to read. Unescape turns them back into the original text, including Unicode escapes such as \u00e9.

The escaper uses the browser's own JSON.stringify and JSON.parse, so the results are exactly what any JSON parser expects. Everything stays in your browser.

FAQ

Do I need to escape forward slashes in JSON?

No. \/ is allowed but optional. It is sometimes used to avoid inside HTML, but plain / is valid.

How do I escape a single quote in JSON?

You do not need to. Single quotes have no special meaning inside JSON strings, which are always delimited by double quotes.

Why does unescape fail?

The text contains an invalid escape such as \x41 or a lone backslash, which JSON does not allow. Fix or remove that sequence and try again.