Encoder

JSON Escape / Unescape

Turn any text, including JSON, into a valid JSON string, or turn an escaped string with \" and \n back into readable text.

When you need this

  • Putting a JSON document inside another JSON value, for example a payload stored as a string in a log or message queue.
  • Pasting multi-line text, code or file paths into a JSON config.
  • Reading a log line where JSON was stored as an escaped string like "{\"id\":1}".

What gets escaped

CharacterEscaped as
Double quote "\"
Backslash \\\
New line\n
Carriage return\r
Tab\t
Other control characters\u0000–\u001f

Non-ASCII characters like é or emoji are valid in JSON strings as they are. Turn on Escape non-ASCII to write them as \uXXXX sequences instead, for systems that only accept ASCII.

Unescaping

Paste an escaped string with or without its surrounding quotes. If the result is itself JSON, it is formatted so you can read it, which is handy for double-encoded payloads. See fixing JSON errors for more on double encoding.

Frequently asked questions

Is escaping the same as URL encoding?

No. JSON escaping uses backslashes inside JSON strings. URL encoding uses %XX sequences inside URLs. Use the URL Encode tool for links and query strings.

Why must the forward slash be escaped?

It doesn’t have to be. JSON allows \/ but doesn’t require it, so this tool leaves / as it is.

How do I fix "Could not unescape"?

The string probably has a quote that isn’t escaped, or a backslash not followed by a valid escape character. Look near the start of the error position.

Is my data uploaded?

No. Everything runs with JavaScript inside your browser tab. Nothing you paste is sent to a server or stored.