Documentation

Learn JSONFiddle by workflow

Short guides for viewing, querying, editing, converting, and exporting structured data in the browser.

Escaped JSON

Escaped JSON (also called "stringified JSON") is JSON that has been serialized as a string. Instead of a clean { "name": "Alice" }, you get "{\"name\":\"Alice\"}" with backslash escapes around every quote.

This happens constantly in real-world development -- API responses wrap JSON in string fields, log files quote it, and CLI tools output it with escaping. JSONFiddle detects escaped JSON automatically and offers one-click unescaping.

Escaped JSON detection Screenshot: The editor showing detected escaped JSON with the unescape banner.


What is Escaped JSON?

When JSON is stored inside a string value, every special character must be escaped:

OriginalEscaped
" (double quote)\"
\n (newline)\\n
\t (tab)\\t
\\ (backslash)\\\\

Common Sources of Escaped JSON

SourceExample
API string fields{ "data": "{\"name\":\"Alice\"}" }
Log files[INFO] payload: {\"users\":[{\"id\":1}]}
CLI outputecho '{"name":"Alice"}' | jq -c wrapped in quotes
Environment variablesCONFIG="{\"db\":{\"host\":\"localhost\"}}"
Message queuesSQS/Kafka messages where the body is a JSON string
Database text columnsJSON stored as a text/varchar string

What It Looks Like

Single-escaped (most common):

"{\"name\":\"Alice\",\"age\":30,\"active\":true}"

Double-escaped (JSON stringified twice):

"\"{\\\"name\\\":\\\"Alice\\\",\\\"age\\\":30}\""

Triple-escaped (rare, but happens in deeply nested systems):

"\"\\\"{\\\\\\\\"name\\\\\\\\\":\\\\\\\\\"Alice\\\\\\\\\"}\\\"\""

Raw backslash-escaped (no outer quotes):

{\"name\":\"Alice\",\"age\":30}

How JSONFiddle Detects Escaped JSON

When you paste content into the editor, JSONFiddle's detection logic checks:

  1. Is the content a quoted string? If the content starts and ends with ", and the interior contains \", it is likely escaped JSON.
  2. What level of escaping? JSONFiddle counts the layers of string escaping:
    • 1 layer: "{\"name\":\"Alice\"}" -> escapedJsonLevels: 1
    • 2 layers: "\"{\\\"name\\\":\\\"Alice\\\"}\"" -> escapedJsonLevels: 2
    • 3 layers: deeper escaping -> escapedJsonLevels: 3
  3. Raw backslash escaping? If the content does not start with " but contains \" patterns, JSONFiddle detects raw backslash escaping.

The Detection Banner

When escaped JSON is detected, JSONFiddle shows a banner at the top of the editor:

This looks like escaped JSON (1x escaped). Click to unescape.

The banner specifies the escaping level (1x, 2x, 3x).

Detection banner Screenshot: The escaped JSON detection banner at the top of the editor.


How to Unescape

One-Click Unescape

  1. Paste escaped JSON into the editor.
  2. The detection banner appears.
  3. Click the banner.
  4. JSONFiddle unescapes the content. The editor shows clean, formatted JSON.
  5. The banner disappears.

One-click unescape Screenshot: The editor after unescaping, showing clean indented JSON.

What Happens During Unescaping

For each level of escaping:

  1. JSONFiddle removes the outer quotes.
  2. It unescapes \" -> ", \\n -> \n, \\t -> \t, \\\\ -> \\.
  3. It parses the result as JSON.
  4. If there are more escaping levels, it repeats the process.
  5. The final result is properly formatted JSON.

Multi-Level Unescaping

For 2x or 3x escaped JSON, JSONFiddle unescapes all levels at once. You do not need to click the banner multiple times.


Examples

Example 1: Single-Escaped JSON from an API

What you paste:

"{\"users\":[{\"id\":1,\"name\":\"Alice\",\"email\":\"alice@example.com\"},{\"id\":2,\"name\":\"Bob\",\"email\":\"bob@example.com\"}]}"

What you get after unescaping:

{
  "users": [
    {
      "id": 1,
      "name": "Alice",
      "email": "alice@example.com"
    },
    {
      "id": 2,
      "name": "Bob",
      "email": "bob@example.com"
    }
  ]
}

Example 2: Double-Escaped JSON from a Logging System

Some logging systems serialize JSON twice -- once for the payload and once for the log message wrapper.

What you paste:

"\"{\\\"event\\\":\\\"user_login\\\",\\\"timestamp\\\":\\\"2024-01-15T10:30:00Z\\\",\\\"user_id\\\":12345}\""

After unescaping (both levels):

{
  "event": "user_login",
  "timestamp": "2024-01-15T10:30:00Z",
  "user_id": 12345
}

Example 3: Raw Backslash-Escaped JSON from Shell Output

What you paste:

{\"config\":{\"database\":{\"host\":\"localhost\",\"port\":5432},\"cache\":{\"ttl\":3600}}}

After unescaping:

{
  "config": {
    "database": {
      "host": "localhost",
      "port": 5432
    },
    "cache": {
      "ttl": 3600
    }
  }
}

Example 4: JSON Inside a JSON String Field

Sometimes the outer JSON is valid, but one of its fields contains an escaped JSON string. Paste just the inner escaped string:

Original API response:

{
  "status": "success",
  "body": "{\"name\":\"Alice\",\"orders\":[{\"id\":101,\"total\":59.99}]}"
}

Copy the value of body (including the outer quotes) and paste it as a new document. JSONFiddle detects the escaping and offers to unescape.


Escaping Detection Levels

LevelPatternDescription
1x escaped"{\"key\":\"value\"}"JSON.stringify() called once. Most common.
2x escaped"\"{\\\"key\\\":\\\"value\\\"}\""JSON.stringify() called twice. Common in message queues.
3x escapedDeeper escapingJSON.stringify() called three times. Rare.
Raw backslash{\"key\":\"value\"}No outer quotes, but internal quotes are escaped. Common in shell output.

Troubleshooting

"No banner appeared"

The detection works for common escaping patterns. If your content uses a non-standard escaping method, the banner may not appear. Try manually removing the outer quotes and unescaping \" to " in the code editor.

"The unescaped JSON is still escaped"

There were more escaping levels than detected. Paste the result again -- if there is another level, a new banner will appear.

"The unescaped result is invalid JSON"

The original content may have been corrupted during escaping. Check for:

  • Incomplete strings (missing closing quotes).
  • Truncated data (common in logs with character limits).
  • Mixed escaping styles (some tools use different escape characters).

"I want to re-escape JSON for testing"

Use JSON Escape / Unescape when you need to turn clean JSON back into an escaped string literal for testing.


FAQ

Q: Can JSONFiddle detect escaped YAML or XML? A: No. The escaped content detection is specific to JSON escaping patterns (\", \\n, etc.).

Q: Does unescaping modify the original content? A: Yes. Clicking the banner replaces the escaped content with the clean JSON. Recover the original with Cmd+Z.

Q: How many escaping levels can JSONFiddle detect? A: Up to 3 levels of string escaping, plus raw backslash escaping.

Q: Can I disable the detection banner? A: Not currently.