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

Related Tools

Learn more about the JSON Escape / Unescape

What Does This JSON Escape / Unescape Tool Do?

This tool turns JSON into a JSON-safe string literal, or decodes one back into readable JSON. Escaping prefixes every double quote and backslash in your input with a backslash, so it can be embedded as the value of a JSON string field — including when that value is itself a full JSON document. Unescaping reverses it, turning a string literal — quotes, \n, \", and all — back into its original, readable text.

Paste raw JSON to escape it, or paste an escaped string to decode it. If the pasted text isn't valid JSON on its own, the tool retries by wrapping it in quotes, which handles content copied without its outer quote marks.

Everything runs locally in your browser; nothing is 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.

How to use

Paste your input in the left editor. The output appears automatically on the right. Use the toolbar buttons to copy, download, or transform the result.

  1. Paste or type your content in the input editor on the left.
  2. The formatted output is generated automatically.
  3. Use Copy, Download, or other actions from the output toolbar.
  4. Click the expand icon to view the output in fullscreen.
FAQ

Is this JSON escape/unescape tool free?

Yes, it is completely free to use with no limits, signup, or account required.

Is my JSON data uploaded to a server?

No. Escaping and unescaping both run entirely in your browser using JavaScript. Your data never leaves your machine.

What does "escape JSON" mean?

It means converting text (often JSON itself) into a single JSON string literal, with every double quote and backslash prefixed by a backslash so it can be safely embedded as the value of a JSON field.

What does "unescape JSON" mean?

It means decoding a JSON string literal — quotes, \n, \", and all — back into its original, readable text.

Can I unescape a string that is missing its surrounding quotes?

Yes. If the pasted text is not valid JSON on its own, the tool retries by wrapping it in quotes, which handles escaped content copied without its outer quote marks.

Can I upload a file instead of pasting text?

Yes. Drag and drop a .json or .txt file onto the input panel, or click the upload icon in the panel header to browse for one. Files up to 5MB are supported.

Why would I need to escape JSON?

Common cases are embedding a full JSON payload as a string field inside another JSON document, packing JSON into an environment variable, or pasting JSON into source code as a string constant.