XML 转 JSON 在线转换器

Free 免费 · 无需注册 · 数据不上传
Indent
Attrs as
Text key
Error
XML
JSON
// JSON output

更多开发工具

XML 格式化
格式化与验证
JSON→XML
转 XML
YAML→JSON
转 JSON
CSV→JSON
转 JSON
TOML→JSON
转 JSON
JSON 格式化
格式化、验证与压缩
Base64
编码/解码
URL 编码
百分比编码

为什么这是最好的 XML 转 JSON 工具

智能数组检测

Repeated sibling elements with the same tag are grouped into JSON arrays. Single-child containers are also detected as arrays when all children share one tag — so a list with one item stays a list.

往返安全

Numeric XML tags like _0, _1 (produced by JSON→XML from numeric-string keys) are correctly restored back to "0", "1".

灵活的属性处理

Choose how XML attributes map to JSON: as @-prefixed keys (default), plain keys, or ignored entirely. Mixed text+attribute elements use a configurable text key.

类型推断

XML text values that look like numbers, booleans, or null are automatically converted to proper JSON types. truetrue, 12801280. Disable to keep all values as strings.

常见问题

How are XML arrays detected?

When a parent element contains multiple children with the same tag name, they are grouped into a JSON array. Additionally, when a parent element contains only same-named children (even just one), those children are also treated as an array — preserving list structure for single-item collections.

Can I round-trip JSON → XML → JSON?

Yes. JSON keys starting with a digit (e.g. "0") are prefixed with underscore by JSON→XML (_0). This converter detects that pattern and restores the original key. Arrays are preserved through both directions.

What does "Skip root" do?

Removes the outermost XML element wrapper so JSON output starts from its children directly. Useful when the root tag (like <root>) is just a container.

Is my data sent to a server?

No. All conversion happens entirely in your browser using JavaScript. Your XML never leaves your device.

深度指南
数据格式转换指南
CSV、XML、JSON、HTML 与 Markdown
阅读指南