Small Tools
JSON utility

JSON Escape / Unescape

Escape text for JSON strings or decode escaped content.

● This tool runs entirely in your browser. Your input is never uploaded to our servers.
Output
Your result will appear here…

How to use JSON Escape / Unescape

  1. Choose Escape for plain text or Unescape for escaped string contents.
  2. Paste the value without surrounding quotation marks.
  3. Run the conversion and copy the result into your JSON string or editor.

Example

Input / settings:

Line one
Line "two"

Output:

Line one\nLine \"two\"

Newline became \n and each double quote gained a backslash. The result has no surrounding quotation marks.

When to use

Overview

JSON Escape turns text into the contents of a JSON string. A backslash and a double quote are prefixed with a backslash, newline, carriage return, tab, backspace and form feed become \n, \r, \t, \b and \f, and any other control character below U+0020 becomes a \uXXXX sequence. The tool does not add the surrounding quotation marks. Unescape reverses the process.

Supported input

Any text to escape, or the contents of a JSON string (without surrounding quotation marks) to unescape.

Output details

Escaped text without surrounding quotation marks, or the decoded text.

Common mistakes

Practical tips

Privacy and security

This tool runs entirely in your browser. Your input is never uploaded to our servers. Escaping and unescaping run locally in your browser. Text escaped for JSON is still untrusted data: escaping does not make it safe to insert into HTML, so use HTML Escape for that purpose.

References

Frequently asked questions

Which characters does JSON Escape change?

The backslash, the double quote, and control characters below U+0020. Letters, digits, accented characters and the forward slash are left alone.

Why does Unescape report an error?

The text contains something JSON does not allow inside a string, such as an unescaped double quote, a raw line break or tab, an unknown escape like \x41, or a trailing backslash.

Can I escape an entire JSON document?

Yes. Quotes and backslashes in the document are escaped, giving text you can store inside another JSON string. To check or reformat the document itself, use JSON Formatter.

Related tools