跳到主要内容

JSON 转 XML

UpBox优盒工具箱,免费在线 JSON 转 XML:粘贴 JSON 即生成格式化 XML,可自定义根节点名、数组条目名与是否缩进换行,自动转义特殊字符并统计标签数。

无需注册 · 数据不上传No sign-up · nothing uploaded

JSON 输入JSON input

XML 结果XML result


          
0 个标签
已转换

键名会被清洗成合法 XML 名称(非法字符换成下划线、数字开头补下划线);null 输出空文本「null」字样;不支持 XML 属性、CDATA 与命名空间声明;不做 XML 反向解析

本工具所有运算在本地浏览器完成,你的文件、文本不会上传到服务器

工具介绍

对接老系统、给第三方传数据,偶尔就是绕不开 XML:接口文档写着要 `` 包一层,你手上却只有 JSON。 Old integrations and third-party handoffs still speak XML: the spec wants an wrapper and all you have is JSON.

贴进来就转:对象嵌套照原样变成子节点,数组每一项单独成一个 item,特殊字符自动转义,JSON 写错了会直接告诉你,不会输出半截 XML。 Paste and convert: nested objects become child nodes, each array element becomes its own item, special characters are escaped, and broken JSON is reported instead of producing half an XML.

  • 自动转义Auto escaping
  • 可改节点名Custom element names
  • 缩进可关Optional indentation
  • 语法报错Syntax reporting

使用说明

  1. 粘贴 JSON。Paste the JSON.
  2. 按需改根节点名。Set the root name if needed.
  3. 数组条目名可改 item。Rename array items.
  4. 复制 XML。Copy the XML.

常见问题

能还原成 JSON 吗?Can it convert back?
这里只做 JSON → XML,反向请用专门的 XML 解析工具。JSON to XML only; use a dedicated parser for the reverse.
支持 XML 属性吗?Are XML attributes supported?
不支持,所有键都输出为元素节点。No, every key becomes an element.
中文键名会怎样?What happens to non-English keys?
中文等非法字符会被替换成下划线,保证 XML 名称合法。Characters that are illegal in XML names are replaced with underscores.
null 怎么处理?How is null handled?
输出文本 null,而不是空标签,方便下游判断字段存在。It is written as the text null rather than an empty tag, so consumers can tell it exists.
广告位

此处为广告位,可放置你的推广素材

支持图片、文字或 HTML 代码,替换本区块内容即可投放

浏览其他分类