String Escape / Unescape

Escape and unescape special characters in strings.

Input
Output
All examples use BASE_URL — set it to your deployment URL.
POST/api/escape
Escape special characters in a string (backslash sequences like \n, \t, \", etc).
const BASE_URL = "http://localhost:3000"; const res = await fetch(`${BASE_URL}/api/escape`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ text: 'Hello "World"\nNew line' }) }); const data = await res.json(); // → { success: true, result: "Hello \\\"World\\\"\\nNew line" }
POST/api/unescape
Unescape backslash sequences back to their original characters.
await fetch(`${BASE_URL}/api/unescape`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ text: 'Hello \\\"World\\\"\\nNew line' }) }); // → { success: true, result: 'Hello "World"\nNew line' }