JSON Escape / Unescape

Escape JSON into a JSON-safe string literal, or unescape one back into readable JSON.

Mode:
Input (raw JSON)
Loading editor…
Escaped Output
Loading editor…
Size: 0 bytesLines: 0

What is JSON Escaping?

JSON strings can only contain a limited set of characters literally — a double quote or a backslash inside a string has to be preceded by a backslash so the parser doesn't mistake it for the end of the string or the start of a new escape sequence. Escaping is the process of converting raw text into that safe, quoted form so it can be embedded as the value of a JSON string field, including when the value is itself a full JSON document.

Unescaping is the reverse: taking a JSON string literal — quotes, \n, \", and all — and decoding it back into the original, readable text.

This page lets you escape or unescape JSON entirely in your browser. Paste raw JSON to get a single-line, JSON-safe string, or paste an escaped string to decode it back — no signup, nothing sent to a server.

Why Escape or Unescape JSON?

Embedding JSON in JSON

When a JSON payload needs to be nested inside another JSON field as a string (e.g. a webhook body, a log entry), every quote and backslash must be escaped or the outer document breaks.

Config Files & Env Vars

Environment variables and some config formats only accept single-line string values. Escaping lets you pack a full JSON object into one of those without a parser choking on it.

Debugging Escaped Payloads

API logs and webhook debuggers often show JSON as an escaped string. Unescaping it instantly turns that wall of backslashes back into something you can actually read.

Source Code Literals

Pasting JSON into a source file as a string constant means escaping it first — this avoids doing it by hand and getting an escape sequence wrong.

Example

Raw JSON on the left, the same JSON escaped into a single JSON string literal on the right.

Before (raw)
{"name":"John Doe","bio":"Loves \"JSON\" and\nnew lines","active":true}
After (escaped)
"{\"name\":\"John Doe\",\"bio\":\"Loves \\\"JSON\\\" and\\nnew lines\",\"active\":true}"

Features

Escape JSON

Turn raw JSON or text into a single JSON-safe string literal, ready to embed in another JSON document.

Unescape JSON

Decode an escaped JSON string back into its original, readable form.

Upload a File

Drag and drop or upload a .json or .txt file instead of pasting.

Copy

Copy the escaped or unescaped output to your clipboard with a single click.

Download

Save the result as a standalone file for use in your project.

Related Tools