OpenReplay Logo
12k

JSON escape/unescape

Escape text into a JSON string or unescape one back to raw text — processed locally, nothing leaves your browser.

Processed locally

About this tool

A JSON string can't contain certain characters literally: double quotes, backslashes, and control characters like newlines and tabs must be written as escape sequences (\", \\, \n, \t), and any character can be expressed as a \uXXXX code unit. This tool escapes raw text into valid JSON string content (built on JSON.stringify, so the output is spec-correct) and reverses the process with JSON.parse, accepting an escaped string with or without its surrounding double quotes.

Use it to embed multi-line text, file paths, or snippets of code inside a JSON payload by hand, to sanity-check what an API or log line actually contains once the escapes are resolved, or to debug 'invalid JSON' errors caused by an unescaped quote or a stray backslash. Toggle "Wrap in quotes" to get a complete string literal you can paste straight into a JSON document, or just the inner content when you only need the body.

Escaping changes how text is represented in JSON, not what it means — it is not encryption or sanitization, and the decoded value is identical to the original.

Frequently asked questions

What characters have to be escaped in a JSON string?

Double quotes (") and backslashes (\) must always be escaped, along with control characters: newline becomes \n, tab \t, carriage return \r, plus \b, \f, and \x00–\x1f for other control codes. Any character may also be written as a \uXXXX escape.

Can I unescape a JSON string that has no surrounding quotes?

Yes. This tool accepts both forms — a full literal like "a\nb" or just the inner content a\nb. Missing quotes are added automatically before parsing, so either paste works.

Why does my JSON string fail to unescape?

The most common causes are an unescaped double quote inside the value, a dangling backslash at the end, or an incomplete \u sequence (fewer than four hex digits). The tool reports the specific parse error so you can locate the bad character.