jsonecho

JSON Escape

Paste your text and get it escaped for JSON, ready to paste into code or data.

Loading the tool...

How to use JSON Escape

  1. Paste or type the text you want to escape.
  2. Adjust the options if you need to.
  3. Copy the escaped result.

About JSON Escape

To put arbitrary text inside a JSON string, you have to escape the double quote, the backslash and all control characters. A line break becomes \n, a tab \t, and anything else below U+0020 becomes \uXXXX. Forget one of them and the whole document is invalid.

This tool turns any text, multi-line or not, into the content of a JSON string. Paste the result between double quotes and you have a valid JSON value.

What gets escaped

Double quote becomes \", backslash \\, line break \n, carriage return \r, tab \t, backspace \b, form feed \f; other control characters become \u00XX.

Frequently asked questions

Is the forward slash escaped?

No. JSON allows \/ but does not require it. Skipping it keeps the text shorter and easier to read.

Are single quotes escaped?

No. JSON strings only use double quotes, so a single quote needs no escape.

Do non-ASCII characters have to be escaped?

No, JSON is UTF-8 and handles any character. The option exists for systems that want pure ASCII on the wire.

How do I handle emoji?

Without the option they stay as they are. With it, they become a surrogate pair such as \ud83d\ude00, which is how JSON writes characters outside the BMP.

More in Escape and Text

All tools →