JSON Escape / Unescape API
Escape text for JSON strings and unescape JSON string contents online. Handles quotes, newlines, tabs and unicode — free, client-side.
The JSON Escape / Unescape is also available as a free REST API. Send a POST request with a JSON body to https://dot.tools/api/tools/json-escape — no authentication, no API key, CORS enabled. Successful calls return { "ok": true, "result": { … } }; failures return HTTP 400 or 422 with an error body.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
text | string | required | The raw text to escape, or the JSON-escaped string to unescape. |
mode | "escape" | "unescape" | required | Whether to escape raw text for embedding in a JSON string or unescape a JSON string back to raw text. |
includeQuotes | boolean | optional | Escape mode only: include the surrounding double quotes in the output (default false). |
Response
| Field | Type | Required | Description |
|---|---|---|---|
result | string | required | The escaped or unescaped result. |
Example request
curl -X POST https://dot.tools/api/tools/json-escape \
-H 'Content-Type: application/json' \
-d '{
"text": "He said \"hello\"\nThen left\twith a wave 👋",
"mode": "escape",
"includeQuotes": false
}'Sample response
{
"ok": true,
"result": {
"result": "He said \\\"hello\\\"\\nThen left\\twith a wave 👋"
}
}Use the free JSON Escape / Unescape in your browser, read the JSON Escape / Unescape guide, or import the full OpenAPI specification.