JSON String Escape & Unescape

Escape quotes, newlines & control chars · Unwrap double-encoded CloudWatch/Kafka JSON

Source Text / Escaped String
0 B
Output
0 B

        
Ready
Cmd/Ctrl+Enter to run · 100% browser-local
Advertisement
Reserved fixed-height slot (CLS = 0.00) 728×90 320×100 300×50

Escaping JSON Literals & Unwrapping Double-Encoded Logs

Structured logging pipelines (AWS CloudWatch, Datadog, Kafka, SQS) frequently serialize an entire JSON payload inside a string property of an outer envelope, producing dense backslash chains like {\"user\":\"ada\"}. Unescaping converts those escaped sequences back into clean, parseable JSON so you can inspect fields or diff them without manual search-and-replace.

Conversely, embedding JSON inside Terraform strings, GitHub Actions expressions, Java/C# test fixtures, or GraphQL variables requires escaping every double quote, backslash, and newline per RFC 8259. This utility runs strictly client-side so production stack traces and webhook bodies remain confidential.

  • Escape SequencesHandles \", \\, \b, \f, \n, \r, \t, and \uXXXX Unicode escapes strictly per RFC 8259 Section 7
  • Double-Encoded UnwrapUnescapes nested JSON strings from AWS Lambda, SQS, CloudWatch, and Java/Go string literals back to readable JSON
  • Outer Quote ControlToggle whether to include surrounding double quotes for direct pasting into code or config templates
What is double-encoded JSON and why does it happen?

Double-encoding occurs when code calls JSON.stringify() on a value that is already a JSON string—common in AWS API Gateway Lambda proxy responses and queue payloads.

Does JSON require escaping forward slashes (/)?

No. While \/ is accepted by RFC 8259 parsers (often used to prevent </script> tags in HTML), plain / is valid in JSON strings.

How are Windows file paths escaped in JSON?

Every backslash must be doubled (\\), turning C:\Users\dev into "C:\\Users\\dev".