JSON escape & unescape

JSON Escape & Unescape Online – Convert JSON Strings Instantly

Working with JSON inside Java source code, JavaScript strings, SQL queries, or configuration files often requires escaping special characters.

Captain JSON’s JSON Escape / Unescape tool helps you convert JSON into escaped strings and restore escaped JSON into its original readable format.

Escape or unescape JSON instantly with a live output preview and simple conversion workflow.

  • 100% offline
  • Privacy first
  • Nothing uploaded

Part of the Captain JSON toolkit — 20+ JSON tools in one extension.

Example: escaping JSON with quotation marks

Illustrative example
JSON input
{"name":"Ada","role":"admin"}
Escaped output
{\"name\":\"Ada\",\"role\":\"admin\"}
Cross Browser Support

Available Across All Major Browsers

Your JSON toolkit. Wherever you develop.

Captain JSON brings essential JSON developer utilities into your everyday browser workflow. Escape JSON strings, convert between data formats, inspect JWT tokens, work with JSONL files, validate JSON schemas, and generate code from JSON. Install Captain JSON on your preferred supported browser and access your developer toolkit from one convenient place.

Available today: Google Chrome, Microsoft Edge and Mozilla Firefox. More browsers are coming soon.

What is JSON escaping?

JSON escaping replaces characters that would break a string — double quotes, backslashes and control characters such as line breaks — with escape sequences like \", \\ and \n, so JSON can be embedded inside another string. Captain JSON’s JSON Escape / Unescape tool converts JSON into an escaped string and restores escaped JSON to its readable form, with a live output preview.

About Captain JSON: Captain JSON is a browser extension by PiratesOfBugs that provides JSON developer utilities including JSON comparison, formatting, pretty printing and validation.

Features

JSON escape and unescape features

Convert in either direction and see the result as you work.

  • Escape JSON

    Convert JSON into an escaped string that is safe to embed.

  • Unescape JSON

    Restore an escaped string to its original, readable JSON.

  • Live output preview

    See the converted output as you work.

  • Instant conversion

    Convert escaped and unescaped JSON in one step.

  • Copy converted output

    Copy the converted result for your code or configuration.

Problem & solution

Stop Manually Escaping JSON Strings.

The problem

JSON frequently needs to be embedded inside programming languages, SQL queries, source code, and configuration files.

Special characters such as quotation marks, backslashes, and line breaks can create formatting problems when JSON is inserted directly into strings.

Manually escaping these characters is time-consuming and can introduce errors.

How Captain JSON helps

Captain JSON simplifies this process by allowing you to escape and unescape JSON with an instant preview.

  • Escape and unescape in one tool
  • Live output preview
  • Runs locally — your JSON never leaves the browser
Use cases

Perfect For

  • Java source code

    Embed JSON in Java string literals.

  • JavaScript strings

    Place JSON inside JavaScript strings.

  • SQL queries

    Prepare JSON text to use as a string value in SQL.

  • Configuration files

    Store JSON inside configuration values.

  • Embedding JSON in code

    Embed JSON in source code without breaking the string.

How to use

How to Escape and Unescape JSON Online

  1. Step 1

    Open Captain JSON

  2. Step 2

    Navigate to JSON Escape / Unescape

  3. Step 3

    Paste or load your JSON content

  4. Step 4

    Select Escape or Unescape

  5. Step 5

    Review the converted output

  6. Step 6

    Copy the result for use in your application or code

Examples

JSON escape and unescape examples

These illustrative examples show escaping and unescaping on typical JSON. They are examples, not screenshots of the extension. Escaped output is shown without surrounding quotes — wrap it in the quotes your language needs.

JSON containing quotation marks

Illustrative example

Every double quote becomes an escaped quote, so the text can sit inside a string.

JSON input
{"name":"Ada","role":"admin"}
Escaped output
{\"name\":\"Ada\",\"role\":\"admin\"}

JSON containing newline characters

Illustrative example

Line breaks become \n sequences, so multi-line JSON fits on one line.

JSON input
{  "id": 1,  "name": "Ada"}
Escaped output
{\n  \"id\": 1,\n  \"name\": \"Ada\"\n}

JSON containing backslashes

Illustrative example

Each backslash is doubled, as well as each quote being escaped.

JSON input
{"path":"C:\\Users\\Ada"}
Escaped output
{\"path\":\"C:\\\\Users\\\\Ada\"}

Escaped JSON restored to readable JSON

Illustrative example

Unescaping turns the escape sequences back into the characters they stand for.

Escaped input
{\"status\":\"ok\",\"count\":2}
Unescaped output
{"status":"ok","count":2}
FAQ

JSON escape and unescape: frequently asked questions

What is JSON escaping?

JSON escaping replaces characters that would otherwise break a string — double quotes, backslashes and control characters such as line breaks — with escape sequences like \", \\ and \n. It lets a JSON document be stored or embedded inside another string without changing its meaning.

How do I escape JSON online?

Open Captain JSON, choose JSON Escape / Unescape, paste your JSON and select Escape. A live output preview shows the escaped string as you work, and you can copy the converted output. Everything runs in your browser, so your JSON is never uploaded.

How do I unescape a JSON string?

Paste the escaped string into the tool and select Unescape. Escape sequences such as \" and \n are turned back into the characters they stand for, restoring readable JSON. You can then check the result with the JSON validator or tidy it with the JSON formatter.

Why does JSON need escaping inside Java strings?

A Java string literal is delimited by double quotes, and JSON is full of them, so an unescaped quote would end the string early. Backslashes and line breaks also have special meaning in Java source. Escaping each one lets the JSON sit safely inside a string literal. If you want Java classes instead, see JSON to Code.

How do I escape JSON for JavaScript?

Escape the JSON text so it can sit inside a JavaScript string literal, then wrap the result in quotes. In code, JSON.stringify applied to a string produces the same kind of escaping. Captain JSON performs the conversion for you and previews the output before you copy it.

Can I embed JSON inside SQL queries?

Yes, as a string value — but remember that Captain JSON applies JSON string escaping, and SQL has its own rules. In standard SQL a single quote inside a string is escaped by doubling it, and some databases treat backslashes specially, so check your database’s rules. Prefer parameterised queries over assembling SQL by hand.

What is the difference between JSON and an escaped JSON string?

JSON is structured data: braces, keys and values. An escaped JSON string is that same text converted into the contents of a string, with quotes and other special characters backslash-escaped, so it can be embedded in code or inside another JSON value. Unescaping reverses the process.

Which special characters need escaping in JSON?

Inside a JSON string the double quote and the backslash must be escaped, as must control characters below U+0020 such as newline (\n), carriage return (\r) and tab (\t). The forward slash may be escaped but doesn’t have to be, and non-ASCII characters can be written directly or as \uXXXX.

Everything You Need to Work With JSON. In One Toolkit.

From escaping JSON strings and converting data formats to inspecting JWT tokens, working with JSONL, validating schemas, and generating code, Captain JSON brings essential developer utilities together in one browser extension.

  • ✓ 100% Offline
  • ✓ Privacy First
  • ✓ Lightweight

We use analytics cookies to understand how the site is used. No personal data is sold. See our privacy practices before choosing.