JSON String Escaper

Escape a block of text into a JSON string value, and unescape it back.

Text safely inside a JSON string

To embed arbitrary text — a message, a code snippet, a multi-line block — as the value of a JSON string, the special characters have to be escaped: quotes, backslashes, newlines and so on. This escapes your text into a valid JSON string and reverses it, so you can drop a block of content into a JSON field without breaking the structure.

Paste text to escape it into a JSON string, or an escaped string to recover the original.

The multi-line and nested cases

Two situations make this genuinely useful. One is multi-line text, where the line breaks must become escaped sequences for JSON to accept them as a single string value. The other is nested JSON — putting a whole JSON document inside a string field, which produces those pile-ups of backslash-quotes that are so hard to read or write by hand. Escaping handles putting it in; unescaping recovers the readable original. It is a focused tool for the specific job of making text safe as a JSON string value.

JSON String Escaper FAQ

What does it escape?

Quotes, backslashes, newlines and other special characters, so a block of text becomes a valid JSON string value.

Does it handle multi-line text?

Yes — line breaks are escaped so the whole block fits into a single JSON string, and unescaping restores them.

Is my text uploaded?

No. The escaping happens in your browser.

More Developer tools