JSON Escape / Unescape Tool
Escape special characters into a safe JSON string literal, or unescape a JSON value back to plain text — and format or minify JSON too. Ideal for embedding data in strings, log statements, and code generation.
How To Use
- Paste or type your value into the JSON input box — a green check shows when it is valid JSON.
- Turn on Apply in place to write each result back into the input for pipeline-style chaining; leave it off to keep a separate Output pane for comparing.
- Pick an action: Format or Minify for JSON, Minify & Escape to generate a ready-to-embed string, Escape / Unescape for string literals, Readable escape to escape while keeping line breaks, or Unicode ↔ 中文.
- Use Use output as input to chain operations, then Copy output to grab the result.
Usage Example
Input (minified JSON):
{"name":"DevToolKit","free":true,"tools":[{"slug":"json"}]} Formatted output:
{
"name": "DevToolKit",
"free": true,
"tools": [
{
"slug": "json"
}
]
} Minify & Escape turns the input into a single quoted string:
"{\"name\":\"DevToolKit\",\"free\":true,...}" To embed the same JSON inside a code string, click Escape on the minified input; to reverse it, click Unescape.
Frequently Asked Questions
Is my data uploaded to a server?
No. Formatting, minifying, escaping, and unescaping all run locally in your browser. Nothing is uploaded.
Does Format / Minify validate my JSON?
Yes. Both actions parse your input with strict JSON parsing. If the input is invalid, a clear error message points to the exact line and column instead of producing output.
What is escaping in JSON?
Escaping replaces special characters such as double quotes, backslashes, and control characters with their JSON-safe escape sequences so the text can live inside a JSON string literal.
Why does Escape turn my newlines into \n?
The JSON spec (RFC 8259) forbids raw control characters inside string
literals — a real newline or tab there makes the string invalid. To
produce a valid JSON string, Escape encodes each newline
as \n and each tab as \t. This does not change
your content: \n is simply the encoding for a newline, and
Unescape decodes it straight back, so the round-trip is
lossless. If you want the output to keep visible line breaks (not a valid
JSON string), use Readable escape instead.
What does Minify & Escape do?
It parses your JSON, compresses it to one line, then escapes it into a quoted JSON string literal — the format you need to embed JSON inside code, logs, or configuration.
What does Readable escape do?
It escapes quotes, backslashes, and control characters but keeps real line breaks and indentation so multi-line text stays readable. Unlike Escape, the result is not a valid JSON string literal — it is meant for readable logs or shell-style embedding.
What is "Apply in place"?
When enabled, clicking an action writes the result straight back into the input box and hides the separate Output pane, giving you a quick pipeline for chaining steps (e.g. Format then Escape). When disabled, results stay in the Output pane so you can compare them against your original input.
Can Format / Minify change my numbers?
Very large integers (beyond 9,007,199,254,740,991) or huge exponent
values lose precision — or overflow to null — because
browsers store JSON numbers as 64-bit floats. When the input contains such
a number, a warning appears below the output. Convert very large IDs to
quoted strings to keep them exact.
Can I unescape any string?
Unescape expects a valid JSON string literal (starting and ending with a double quote). Other inputs produce a clear error message.