JSON Escape / Unescape

Escape any text so it can sit safely inside a JSON string — quotes, backslashes, newlines and control characters handled — or unescape a JSON string literal back to readable text.

json-escape · runs locally

What this JSON escape tool does

A JSON string can hold any text — but only if the characters that would break the syntax are escaped. Paste multi-line text, code, or anything containing quotes into a JSON document unescaped and the result won’t parse. This tool applies exactly the escaping the JSON specification defines, using the same serializer your runtime uses, so the output is correct by construction: quotes become \", backslashes become \\, newlines become \n, and control characters become \uXXXX sequences.

Unescape mode reverses the process — paste an escaped string (with or without its surrounding quotes) and read the original text.

How to escape text for JSON

  1. Choose Escape or Unescape.
  2. Paste your text — multi-line input is fine.
  3. For escaping, tick Include surrounding quotes if you want a complete string literal.
  4. Click the button and copy the result.

The classic use case: JSON inside JSON

Webhook payloads, message queues and audit logs often store one JSON document as a string field of another. Reading those nested payloads means unescaping the inner string first — paste the field value here, unescape, then pretty-print the result with the JSON Formatter. Writing them means the reverse: format the inner document, escape it here, and paste it in as a value.

Frequently asked questions

Which characters does JSON require escaping?

Inside a JSON string you must escape the double quote (\"), the backslash (\\) and all control characters — most commonly newline (\n), tab (\t) and carriage return (\r). Everything else, including unicode characters and emoji, may appear literally.

When do I need to escape text for JSON?

Whenever text becomes the value of a JSON string by hand: embedding a code snippet or SQL query in a config value, writing test fixtures, crafting API request bodies in a terminal, or putting JSON inside JSON — a serialized payload stored as a string field.

What is double escaping?

Escaping already-escaped text, which produces sequences like \\n where \n was intended. It happens when text passes through two serializers. If unescaping once still shows backslash sequences, the text was double escaped — unescape again.

What does 'include surrounding quotes' do?

With it on, the output is a complete JSON string literal including the opening and closing double quotes — ready to paste as a value. With it off, you get just the escaped content, useful when the quotes already exist in your document.