JSON Escape / Unescape

Escape JSON or text into a string-safe payload for embedding in code, with quote wrapping options.

"{\n  \"name\": \"Ann\",\n  \"msg\": \"Hello \\\"world\\\"\"\n}"

About JSON Escape / Unescape

JSON Escape / Unescape converts a JSON value (or any text) into a string-safe payload that can be embedded inside another string — quotes, backslashes, newlines, tabs, and control characters all get escaped. Or run the inverse: take an escaped string and restore the original characters. Optional outer-quote wrapping turns the result into a complete JSON string literal ready to paste into source code.

This is the operation you reach for when you need to embed JSON inside JSON (or inside a string that will become JSON): a JSON value that contains JSON-as-text, an SQL string literal that holds a JSON column value, an HTTP header value with quoted content, or a hand-written test fixture where a property value should be a JSON string. It is not the same as JSON Formatter — Formatter pretty-prints valid JSON, while this tool turns text into a single safely-escaped JSON string. Reverse the operation when you have an escaped string and want the original characters back.

Examples

Input
{"name":"Ada"}
Output
"{\"name\":\"Ada\"}"

Escape with outer quoting on. The output is a complete JSON string literal ready to paste into source code.

Frequently asked questions

When would I escape JSON twice?

When a system stores JSON values inside another JSON document as strings. For example, an audit-log entry whose `payload` field is a string containing the original event's JSON; you escape the inner JSON to fit it inside a string slot.

How is this different from JSON Formatter?

Formatter operates on valid JSON and produces valid JSON — pretty or minified. Escape operates on any text and produces a string-safe representation, which by itself is not the same JSON. They are complementary: format first, then escape if you need to embed.

Does it escape Unicode characters?

Optionally. The default is to keep printable Unicode as-is; toggle the ASCII-safe option to escape non-ASCII as `\uXXXX` sequences, useful for environments that mishandle UTF-8.

What if the input is already escaped?

Use the unescape direction. Pasting an escaped string into the escape side will double-escape it, which is sometimes what you want and sometimes not — check before relying on the output.