Skip to content

JSON Escape & Unescape

Turn any text into a JSON string literal, or unwrap one back to plain text.

Direction

Quick Tool Overview

The JSON Escape & Unescape tool converts text into a valid JSON string literal and back again, handling quotes, backslashes, line breaks, tabs, control characters and Unicode in both directions.

What it does
Escapes text into a JSON string, or unescapes one back
You give it
Plain text, or an escaped JSON string
You get back
The converted text, optionally wrapped in quotes
Best for
Embedding HTML, SQL or stack traces inside JSON payloads
Developer Tools Free, unlimited use No sign-up Runs in your browser

About the JSON Escape & Unescape

A JSON string cannot hold a raw double quote, backslash, line break, tab or control character. Escaping rewrites each one as the sequence a parser accepts: a quote becomes \", a backslash becomes \\, a newline becomes \n and a tab becomes \t.

This comes up constantly when one document is embedded in another — an HTML snippet inside a JSON config, a SQL statement inside a test fixture, a stack trace inside a log payload. Unescaping goes the other way, which is what you need when a log line arrives as one long escaped string and you want to read the newlines as newlines. There is an option to wrap the result in quotes so the output is a complete literal you can paste straight into a document.

Key features of the JSON Escape & Unescape

Both directions

Escape to embed one document inside another, or unescape to read a log line whose newlines arrived as backslash-n.

Complete literals

Optionally wrap the result in double quotes so the output is a finished string you can paste straight into a document.

Control characters handled

Tabs, form feeds, backspaces and every other character below U+0020 are escaped correctly, not just quotes and newlines.

ASCII-safe mode

Rewrite emoji and non-Latin scripts as \u sequences when the payload has to survive a system that is not UTF-8 clean.

Catches double escaping

Unescaping a string that was escaped twice shows you immediately, which is the usual cause of a literal that will not parse.

How to use the JSON Escape & Unescape

  1. 1

    Pick a direction

    Escape turns plain text into a JSON string; unescape turns a JSON string back into plain text.

  2. 2

    Paste your text

    Any text works — HTML, SQL, a stack trace or a multi-line message.

  3. 3

    Choose the wrapping

    Turn on surrounding quotes to get a complete literal, or leave it off to get just the escaped body.

  4. 4

    Copy the result

    The converted text updates as you type and copies with one click.

Frequently asked questions

The double quote, the backslash, and every control character below U+0020 — which in practice means newline, carriage return, tab, backspace and form feed. The forward slash may be escaped but does not have to be.

Reviews of the JSON Escape & Unescape

What people who use the JSON Escape & Unescape think of it. Reviews come from visitors and are posted as written.

No ratings yet

Yours would be the first.

  • 5 0 reviews rated 5 stars
  • 4 0 reviews rated 4 stars
  • 3 0 reviews rated 3 stars
  • 2 0 reviews rated 2 stars
  • 1 0 reviews rated 1 star

Write a review

Used this tool? Your rating helps the next person decide.

Your rating

Plain text only — links, email addresses and HTML are not accepted. Your name and review are shown publicly; nothing else is collected. See the privacy policy.

0 reviews

Newest first

No reviews yet

Be the first to rate the JSON Escape & Unescape. It takes half a minute and no account.

Write the first review

More developer tools