JSON Escape / Unescape
Paste your JSON, then Format, Minify, or escape it — everything runs locally in your browser.
Apply in place is on — results replace the input.
More transforms (escape / encode)
Result appears here — pick Format, Minify, or an escape action.
Tip: press Ctrl+Enter in the input to repeat the last action.
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 the two Unicode ↔ CJK buttons (Unicode → CJK / CJK → Unicode).
- Use Use as input to feed the result back into the input and chain another operation, then Copy to grab the result (the button reads Copy result while Apply in place is on).
Usage Example
Input (minified JSON):
{"name":"Utiltown","free":true,"tools":[{"slug":"json"}]} Formatted output:
{
"name": "Utiltown",
"free": true,
"tools": [
{
"slug": "json"
}
]
} Minify & Escape turns the input into a single quoted string:
"{\"name\":\"Utiltown\",\"free\":true,...}" To embed the same JSON inside a code string, click Escape on the minified input; to reverse it, click Unescape.
Use Cases
Format messy API responses or one-line config dumps into readable, diff-friendly text before committing them. Minify JSON to shrink a payload before it goes into a log line or a message queue. Escape a JSON document into a string literal so it can live inside code, templates, or test fixtures. Debug a Webhook or JWT payload by re-indenting it in seconds. When a document is too deeply nested to read comfortably as text, the JSON Viewer (tree) lets you collapse branches, search keys, and edit values in place.
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.
What does Sort keys do?
Sort keys recursively re-orders the keys of every object in your JSON into alphabetical order, so the output is deterministic and easy to scan. Array elements keep their original order — only object keys are sorted, at every nesting depth.
How do I escape double quotes in JSON?
Inside a JSON string literal, every double quote must be written as \" — a backslash followed by the quote. For example {"message": "He said \"hi\""} is the valid way to carry the text He said "hi" inside JSON. The Escape button on this page performs that replacement for you, along with backslashes (\\) and control characters; Unescape reverses it.
Do single quotes need escaping in JSON?
No. JSON string literals are defined with double quotes only, so an apostrophe like it's is a plain character that needs no escape — writing \' inside JSON is actually an error, because \' is not a defined escape sequence. This trips developers who come from JavaScript or SQL, where single quotes do get escaped. The only characters JSON requires you to escape are the double quote, the backslash, and control characters (which may optionally be written as \uXXXX).
What is double-escaped JSON and how do I unwrap it?
A doubly-escaped string is JSON that was converted to a string and then escaped again — visible as backslash-backslash sequences like {\"a\":1} (each quote is preceded by two backslashes). It happens when serialized output is embedded into another string and processed once more. To unwrap it: click Unescape once per layer, or for a full document use Unescape and then Format to re-indent. The tree badge on embedded (double-encoded) JSON in the JSON Viewer does the same job interactively.
Need to compare two JSON documents?
This toolbox works on a single document at a time. To compare two JSON documents side by side, use the dedicated JSON Diff tool.
Want to explore your JSON as a collapsible tree?
Formatting reshapes the text; it does not help you navigate the structure. With valid JSON in the input, the "View as tree" button hands it over to the JSON Viewer, where you can collapse branches, search keys and values, edit nodes in place, and copy field paths.
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.