JSON转XML
把 JSON 结构转换为缩进良好的 XML。
关于「JSON转XML」
它属于「JSON 工具」分类:JSON 的格式化、结构变换与各种数据格式互转。
- 对象的键会成为<b>标签名</b>,数组的每个元素会重复生成同名标签。
- 文本中的 <code>&</code>、<code><</code>、<code>></code>、引号会自动转义为 XML 实体。
- 不符合 XML 命名规范的键(含空格、以数字开头等)会被替换为下划线并补上前缀。
- <code>null</code> 与 <code>undefined</code> 会输出为自闭合的空标签。
- 可自定义根节点名称与缩进宽度,缩进设为 0 即输出紧凑格式。
完全免费、无需注册;所有处理都在浏览器本地完成,文件不会上传到任何服务器。
相关关键词:JSON转XML、JSON 工具、xml、在线工具、免费
如何使用「JSON转XML」
- 打开工具:打开「JSON转XML」页面,无需注册、无需安装任何软件。
- 准备输入:准备好要处理的内容或文件:文本可直接粘贴,文件可拖入页面(本工具属于「JSON 工具」)。
- 填入内容:把内容粘贴进输入框,或把文件拖入页面;也可以点击「示例」先填入样例数据试一下。
- 设置选项并处理:按需调整页面上的选项,然后点击处理 / 转换 / 生成按钮。
- 获取结果:处理完全在浏览器本地完成,结果可直接复制或下载,文件不会上传到任何服务器。
常见问题
- 数组是怎么转换的?
- 数组不会产生额外的包裹层,而是把同名标签重复输出多次,这也是 XML 里表示列表最常见的写法。
- 键名里有空格或中划线怎么办?
- XML 标签名不允许包含空格等字符,工具会自动把非法字符替换成下划线;如果键名以数字开头,还会在前面补一个下划线。
- 能生成属性而不是子标签吗?
- 当前统一生成子标签形式。反向的「XML转JSON」工具会把属性读取为带 <code>@</code> 前缀的键,两者可以配合使用。
JSON to XML (English)
Convert JSON structures into well-indented XML.
Belongs to “JSON Tools”: Format, transform and convert JSON to and from various data formats.
- Object keys become <b>tag names</b>; each array element repeats the same tag.
- Text <code>&</code>, <code><</code>, <code>></code> 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.
- <code>null</code> and <code>undefined</code> are 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 it
- Open the tool:Open the “JSON to XML” page — no sign-up and nothing to install.
- Prepare the input:Prepare the content or file to process: paste text or drop a file onto the page (this tool belongs to “JSON Tools”).
- 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 <code>@</code>, so they work together.
More tools in JSON Tools
- JSON Formatter/Minifier — Beautify, minify, validate and highlight JSON.
- Sort JSON Keys — Recursively sort object keys alphabetically to ease diffing.
- Flatten JSON — Flatten nested structures into a.b.c single-level keys.
- Unflatten JSON — Restore dotted-path objects into nested structures.
- JSON to CSV — Convert an array of objects into a downloadable CSV.
- CSV to JSON — Parse CSV text or files into a JSON array.
- JSON to Excel — Export an array of objects as an .xlsx workbook.
- Excel to JSON — Upload an Excel file and convert sheets to JSON.
- XML to JSON — Parse an XML document into an equivalent JSON object.
- JSON to YAML — Convert JSON into more readable YAML.
- YAML to JSON — Parse YAML config into standard JSON.
- JSON to SQL — Generate INSERT statements and CREATE TABLE DDL from arrays.
- SQL to JSON — Reverse-engineer JSON data from INSERT statements.
- JSON to Base64 — Convert JSON to and from Base64 with UTF-8 support.
- JSON ⇄ Cookie — Convert between Cookie strings and JSON key-values.
- JSON Diff — Recursively compare two JSON documents, marking add/delete/change.