JSON转XML
把 JSON 结构转换为缩进良好的 XML。
关于「JSON转XML」
它属于「JSON 工具」分类:JSON 的格式化、结构变换与各种数据格式互转。
- 对象的键会成为标签名,数组的每个元素会重复生成同名标签。
- 文本中的
&、<、>、引号会自动转义为 XML 实体。 - 不符合 XML 命名规范的键(含空格、以数字开头等)会被替换为下划线并补上前缀。
null与undefined会输出为自闭合的空标签。- 可自定义根节点名称与缩进宽度,缩进设为 0 即输出紧凑格式。
完全免费、无需注册;所有处理都在浏览器本地完成,文件不会上传到任何服务器。
相关关键词:JSON转XML、JSON 工具、xml、在线工具、免费
如何使用「JSON转XML」
- 打开工具:打开「JSON转XML」页面,无需注册、无需安装任何软件。
- 准备输入:粘贴 JSON 结构,转换为缩进良好的 XML 文档。
- 填入内容:把内容粘贴进输入框,或把文件拖入页面;也可以点击「示例」先填入样例数据试一下。
- 设置选项并处理:按需调整页面上的选项,然后点击处理 / 转换 / 生成按钮。
- 获取结果:处理完全在浏览器本地完成,结果可直接复制或下载,文件不会上传到任何服务器。
常见问题
- 数组是怎么转换的?
- 数组不会产生额外的包裹层,而是把同名标签重复输出多次,这也是 XML 里表示列表最常见的写法。
- 键名里有空格或中划线怎么办?
- XML 标签名不允许包含空格等字符,工具会自动把非法字符替换成下划线;如果键名以数字开头,还会在前面补一个下划线。
- 能生成属性而不是子标签吗?
- 当前统一生成子标签形式。反向的「XML转JSON」工具会把属性读取为带
@前缀的键,两者可以配合使用。
JSON to XML
Convert JSON structures into well-indented XML.
About JSON to XML
Belongs to “JSON Tools”: Format, transform and convert JSON to and from various data formats.
- Object keys become tag names; each array element repeats the same tag.
- Text
&,<,>and quotes are auto-escaped to XML entities. - Keys that violate XML naming rules (spaces, starting with a digit, etc.) are replaced with underscores and prefixed.
nullandundefinedare output as self-closing empty tags.- Customize the root name and indent width; set indent to 0 for compact output.
Free, no sign-up; everything runs locally in your browser and files are never uploaded.
Keywords: JSON to XML, JSON Tools, xml, online tool, free
How to use JSON to XML
- Open the tool:Open the “JSON to XML” page — no sign-up and nothing to install.
- Prepare the input:Paste a JSON structure to convert it into a well-indented XML document.
- Provide the input:Paste your content into the input box or drop a file onto the page; you can also click “Sample” to try example data first.
- Adjust options and run:Adjust the options if needed, then click the process / convert / generate button.
- Get the result:Everything runs locally in your browser; copy or download the result — your files are never uploaded.
FAQ
- How are arrays converted?
- Arrays add no extra wrapper; the same tag is repeated for each item — the common XML list pattern.
- What if a key has spaces or dashes?
- XML tag names cannot contain spaces, so illegal characters are replaced with underscores; a leading underscore is added if the key starts with a digit.
- Can it emit attributes instead of child tags?
- Currently child tags are always used. The reverse "XML to JSON" tool reads attributes as keys prefixed with
@, so they work together.