Mode:

Input

Output

What Is JSON Escape?

In JSON strings, certain characters must be escaped: double quotes, backslashes, newlines, tabs, and control characters. Escaping converts them to sequences like \", \\, \n, \t. The JSON spec defines which characters need escaping. Unescaping does the reverse: it turns those sequences back into the actual characters.

This tool has two modes: Escape and Unescape. Toggle between them at the top. Both run in your browser; nothing is sent to a server.

How to Use This Tool

1

Choose Mode

Select Escape to convert special characters to escape sequences, or Unescape to convert them back.

2

Paste Input

Paste your text into the left editor. You can paste a raw string, a JSON string value, or a full JSON document. Use Sample or Upload if needed.

3

Copy Result

The right panel updates automatically. Use Copy or Download to get the result. For parsing escaped JSON strings into objects, try String to JSON.

JSON Escape Examples

Escaping converts special characters to escape sequences. Telecom-themed example:

Raw input (with newline)

Input

Escaped output

Output

When Escaping Matters

When you embed a JSON string inside another JSON string, or when you store JSON in a database field that expects a string, escaping ensures the inner quotes and backslashes don't break the structure. When building JSON programmatically, JSON.stringify() handles escaping automatically. This tool is for manual editing or when you're working with pre-escaped strings from logs or APIs.

Unescaping is useful when you receive a double-escaped string (e.g. from an API that returns JSON as a string) and need to get the actual JSON. The String to JSON tool can parse escaped strings directly.

Frequently Asked Questions

What characters get escaped?

In JSON: "\", \\\, newline → \n, tab → \t, carriage return → \r, and control characters → \uXXXX. See RFC 8259 for the full list.

Does this work on full JSON or just strings?

Both. In Escape mode, the whole input is treated as a string and escaped. In Unescape mode, escape sequences are converted back. For parsing a JSON string into an object, use String to JSON.

Is my data sent anywhere?

No. Processing runs in your browser.

What about Unicode characters?

Unicode outside the basic BMP can be escaped as \uXXXX (or surrogate pairs). The tool follows standard JSON escaping rules.

When would I need to unescape?

When JSON is stored or transmitted as a string (e.g. in a database, or as an API response that wraps JSON in another string). The outer layer adds escaping; unescaping removes it so you can parse the inner JSON.

Related Tools

The JSON string escaping rules are in RFC 8259. MDN covers JSON in JavaScript. The JSON specification defines all escape sequences. For parsing JSON in JavaScript, see JSON.parse().