OpenAI & Anthropic API JSON Text String Unescaper
Convert literal \n, \", \t, and \u2019 escape sequences from API responses into properly formatted prose.
const cleaned = text.replace(/\\r\\n|\\n|\\t|\\"/g, '');
$...$), Markdown data tables, and ISO-8601 timestamps are strictly preserved.
Deterministic Sanitization Specification & Live Diff
{\n \"status\": \"success\",\n \"message\": \"First paragraph.\n\nSecond paragraph with \"quoted\" text.\"\n}{ "status": "success", "message": "First paragraph.Second paragraph with "quoted" text."}How to Clean OpenAI & Anthropic API JSON Text String Unescaper Online
ClipNText OpenAI & Anthropic API JSON Text String Unescaper is a client-side text sanitizer that strips Raw JSON Backslash Escape Sequences (\n, \"), orphaned delimiters, and syntax clutter from ai. Executing locally via asynchronous browser Web Workers (scrub.worker.js), the utility processes multi-megabyte payloads in under 15 ms without transmitting sensitive prompt data to external servers. Sanitizing formatting noise reduces downstream API context window consumption by 18% to 52% while preserving code blocks, citations, and table structures for clean documentation or RAG ingestion.
| Target Artifact | Regex / Pattern Signature | Sanitization Behavior |
|---|---|---|
{\n \"status\": \"success\",\n \"message\": |
/\\r\\n|\\n|\\t|\\"/g |
When inspecting raw API JSON payloads or terminal output, linebreaks and quotes are escaped as literal two-character \n and \" sequences. |
{
"status": "success", |
/[ \t]{2,}|\u200B/g |
Collapses redundant whitespace and purges invisible zero-width tokens. |
Raw JSON Backslash Escape Sequences (\n, \")
When inspecting raw API JSON payloads or terminal output, linebreaks and quotes are escaped as literal two-character \n and \" sequences.
/\\r\\n|\\n|\\t|\\"/g
Technical Edge-Case FAQ
Common engineering questions regarding character preservation, encoding boundaries, and browser worker performance: