JSON Escape and Unescape

Skip to editor
Explorer
Open Files

No files open

0 files open

jsoneditor.io v2

No file open

Create a new file or open an existing one from the sidebar

JSONUTF-8
Spaces: 2

How do I escape a string for JSON?

To escape a string for JSON, paste it above, open Convert and press Escape. Quotes become \", backslashes become \\, and line breaks and tabs become \n and \t, so the text can sit safely inside a JSON string. Unescape turns an escaped string back into readable text.

It's handy when an API or a log hands you JSON wrapped inside a string. Paste it in, surrounding quotes and all, press Unescape, and then Format to make it readable again.

  1. Paste your text or JSON into the editor.
  2. Open Convert and press Escape or Unescape.
  3. Copy the result.

Example

JSON
{
  "event": "deploy",
  "message": "Shipped \"v1.4.0\" to production"
}
Escaped
{\n  \"event\": \"deploy\",\n  \"message\": \"Shipped \\\"v1.4.0\\\" to production\"\n}

Questions people ask

Which characters need escaping in JSON?

Inside a JSON string you have to escape double quotes, backslashes and control characters like line breaks and tabs. Everything else, unicode and emoji included, can appear as it is.

Why does Unescape fail?

The text has to be a valid escaped JSON string, so a lone backslash or an unescaped quote in the middle will stop it. Usually that means the text was never escaped in the first place.

Is my data uploaded anywhere?

No, this runs entirely in your browser, so nothing you paste is sent to a server. The only feature that sends data anywhere is the optional AI assistant, and only when you actually ask it something.