JSON Escape / Unescape

Turn text, JSON or XML into a single JSON string literal (quotes, backslashes and line breaks escaped) — or unescape a stringified JSON value back to the original. Runs in your browser.

Suggested tools

HTML Escape / Unescape

Encode < > & " ' as HTML entities, or decode entities back to text.

HTML
Open Tool

XML Escape / Unescape

Make text safe for XML elements and attributes, or decode it back.

XML
Open Tool

JavaScript Escape / Unescape

Turn text into a safe JS string literal, or unescape it back.

JavaScript
Open Tool

Java Escape / Unescape

Escape text for Java strings and .properties files, or unescape it.

Java
Open Tool

C# / .NET Escape / Unescape

Escape text for a C# or VB.NET string literal, or unescape it.

NET
Open Tool

CSV Escape / Unescape

Quote a value correctly for CSV, or unwrap a quoted CSV field.

CSV
Open Tool

About JSON Escape / Unescape

JSON Escape turns text, JSON or XML into a single JSON string literal: quotes and backslashes are escaped and line breaks become \n, so the content can be embedded as a value inside another JSON document, an environment variable or source code.

Unescape does the reverse — paste a stringified JSON value (for example from a log line or a database field) and get the original back. It runs entirely in your browser, so nothing you paste is uploaded.

How to use JSON Escape / Unescape

  1. Paste text to escape, or an escaped string to unescape.
  2. Press Escape or Unescape.
  3. Copy the result.

Key features

  • Escape and Unescape on one page
  • Valid JSON string literal with quotes
  • Handles JSON, XML or any text
  • Clear error for invalid escaped strings

Example

Two lines of text with quotes, turned into one JSON string literal.

Input
Line one
He said "hi"
Output
"Line one\nHe said \"hi\""

When to use JSON Escape / Unescape

  • Storing a JSON document as a string field inside another JSON payload.
  • Putting multi-line text into a JSON config or environment variable.
  • Reading double-encoded JSON from logs or message queues.

Tips and common problems

  • If the unescaped result is still full of \", unescape it again.
  • Escaped output includes the surrounding quotes, ready to paste as a value.
  • For JavaScript, Java or C# string literals, use the language-specific escape tools.

Frequently asked questions

When JSON has to be stored as a string inside other JSON — for example a payload field, a message queue or a config value.