JSON Escape / Unescape

JSON Escape / Unescape converts text into a safely escaped JSON string literal — quotes, backslashes, newlines and control characters all handled — or reverses the process to recover the original text from an escaped string.

It is the fastest way to drop a block of JSON into a string variable, or to read an escaped string copied out of a log line. Everything runs locally in your browser.

Text to escape
Escaped string
Escaped string literal appears here.

How to use JSON Escape / Unescape

  1. 1

    Choose a direction

    Escape turns text into a string literal; Unescape decodes one.

  2. 2

    Paste your input

    Drop in the text to escape, or the escaped string to decode — output updates live.

  3. 3

    Copy the result

    Grab the escaped or decoded output with the copy button.

When to escape JSON

Escaping is needed whenever JSON has to live inside another string: a JSON value that itself contains JSON, a payload embedded in source code, or data passed through a logging system. Escaping wraps the text in quotes and replaces special characters with their backslash sequences so it survives intact.

Unescaping does the reverse — handy when you copy something like \"{\\\"id\\\":1}\" out of a log and want the real JSON back.

What gets escaped

Double quotes become \", backslashes become \\, and control characters such as newlines and tabs become \n and \t. The unescape direction accepts the escaped body either with or without its surrounding quotes.

Because escaping is a pure string transformation, it never validates the content as JSON — you can escape any text, not just JSON.

Frequently asked questions

What is the difference between escape and unescape?
Escape converts raw text into a quoted, backslash-escaped JSON string. Unescape takes such a string and returns the original text.
Does the input have to be valid JSON?
No. Escaping works on any text. Unescaping expects a valid escaped string literal and reports an error otherwise.
Is my data sent to a server?
No. The conversion runs entirely in your browser.

Last updated: