JSON Escape / Unescape

Escape any text so it can be placed inside a JSON string — or unescape a string full of \" and \n back into readable text.

Escaped string
Ctrl + Enter to run

Runs 100% in your browser — your data is never uploaded to our server.

When do you need to escape JSON?

Inside a JSON string, some characters have special meaning. A double quote would end the string, a backslash starts an escape sequence, and raw line breaks are not allowed at all. To embed text — including an entire JSON document — as a string value, those characters must be escaped. You also run into escaped JSON constantly in the opposite direction: log files, message queues, environment variables and API fields often contain JSON that was stringified, so it is full of \" sequences and hard to read.

Escape sequences

CharacterEscaped
double quote "\"
backslash \\\
new line\n
carriage return\r
tab\t
other control characters\u0000–\u001f

How to use it

  1. Choose Escape to turn raw text into a JSON string, or Unescape to reverse it.
  2. Paste your text. When unescaping, you can include or omit the surrounding quotes.
  3. If the unescaped result is itself JSON, it is pretty-printed automatically (you can turn this off).

Example

Escaped

{\"user\":\"asha\",\"note\":\"hi\\nthere\"}

Unescaped

{
  "user": "asha",
  "note": "hi\nthere"
}

Frequently asked questions

Is this the same as JSON.stringify?

Escape mode produces exactly what JSON.stringify produces for a string. Tick “wrap in quotes” to include the surrounding double quotes.

Does it escape non-English characters?

No — JSON allows any Unicode character directly, so é or 日本 stay readable. When unescaping, \u sequences are converted back into the real characters.

Can I unescape text that was escaped twice?

Yes, run Unescape again on the result.

Is my text uploaded?

No. Everything runs in your browser.