XML转JSON工具
将XML文档转换为JSON。属性会转换为带@前缀的键;重复的标签会转换为数组。
如何使用本工具
- 1
Paste or type your XML into the input box.
- 2
Read the converted JSON in the output panel below, which updates as you type.
- 3
If the XML is malformed, fix the error shown in red and the output will reappear.
- 4
Select the JSON from the output panel to copy it into your project.
什么是XML转JSON工具?
从XML转换到JSON在某些方面会有信息损失:XML支持命名空间、处理指令和CDATA节,而这些在JSON中没有直接的对应物。本转换工具能处理90%的情况:嵌套元素、属性(带@前缀)和文本内容(#text)。对于复杂的XML,可能需要使用专门的库。
常见使用场景
Inspect a SOAP or legacy XML API response as JSON before wiring it into a JavaScript front end.
Convert an RSS or Atom feed snippet into JSON to prototype a parser quickly.
Turn a config file or build manifest written in XML into JSON to eyeball its structure.
Pull values out of an XML sitemap or data export when a JSON shape is easier to traverse.
Teach or learn how attributes, repeated tags, and text nodes map between the two formats.
Sanity-check that a small XML payload is well-formed, since malformed input shows a parser error.
常见问题
@前缀是什么意思?▼
相关工具
JWT解码器
即时解码JSON Web Token(JWT)。完全在你的浏览器中运行:令牌绝不会离开你的设备,可安全用于生产环境的密钥。
JSON格式化与校验工具
在线格式化、校验和压缩JSON。完全在你的浏览器中运行:你的数据永远不会离开你的设备。
XML格式化工具
格式化并美化XML文档。适用于SOAP、站点地图、RSS订阅源和配置文件。
Base64编码与解码工具
将字符串编码为Base64,或将Base64解码为文本。尊重你的隐私:全部在你的浏览器中运行。
URL编码与解码工具
将文本转换为URL安全的编码(百分号编码),或进行反向转换。适用于查询字符串、重定向和OAuth流程。
HTML实体编码与解码工具
将特殊字符转换为HTML实体(&、<等),或进行反向转换。适用于将文本安全地嵌入HTML。