为什么用这个工具
03JSON 转义在浏览器本地运行,适合快速处理与复制结果。
JSON 转义适用于日常高频小任务,打开即用。
默认本地处理,便于快速检查与复制结果。
如何使用
02复制前快速检查
03先确认输入格式符合你的预期。
在把结果用于文档、链接、配置或消息前快速扫一眼。
只复制你真正需要的输出。
使用场景
Webhooks expect a JSON body where the message text is a JSON string value. Multi-line messages or messages containing quotes break the JSON if pasted raw — escape them here first.
When sending a GraphQL query as a JSON body, the query string itself is a JSON value. Backslashes, quotes, and newlines inside the query need to be JSON-escaped — drop the raw query in to get the safe form.
Many systems store complex strings as JSON-encoded values (e.g., error stack traces with quotes). Paste the encoded form into Unescape mode to recover readable text.
When an environment variable needs to hold a JSON document (Vercel, Docker, Kubernetes), the variable value is a string and the JSON inside it must be self-consistent. Escape the JSON document with outer quotes off, then wrap with single quotes in your env file.
When sharing code samples in a JSON-based API (issue tracker, documentation system), the code becomes a JSON string. Escape converts your <code>\n</code>-separated code into a single-line escaped form that round-trips cleanly.
使用技巧
- 01JSON escape ≠ URL encode ≠ HTML escape
JSON escape handles characters that would break a JSON string value (<code>"</code>, <code>\</code>, control chars, newlines). URL encoding handles URL-reserved characters (<code>?</code>, <code>&</code>, spaces). HTML escape handles HTML-reserved characters (<code><</code>, <code>></code>, <code>&</code>). Pick the encoding that matches the context the string will live in.
- 02Outer quotes matter for paste-and-go
With outer quotes ON, the output is a complete JSON string literal you can paste directly into a JSON document. With OFF, you get the inside of the string — useful for template-string concatenation in code where you'll add quotes yourself.
- 03Unicode characters above U+FFFF use surrogate pairs
JSON encoding of emoji and rarely-used scripts uses the <code>\uHHHH\uHHHH</code> surrogate-pair convention. Most JSON parsers handle this correctly; if a downstream system rejects surrogates, that's a parser bug — not a JSON spec issue.
- 04Round-tripping is loss-free
Escape then immediately Unescape should return the exact original text. If it doesn't, the unescape input is malformed (typically a stray <code>\</code> at the end, or unclosed escape sequence). Watch for this when copy-pasting from formatted log output that may have wrapped lines mid-escape.
常见问题
01
这个工具会上传数据吗?
默认在浏览器本地处理。