JSON to XML
JSON has no attributes, so turning it into XML means agreeing on a convention: keys prefixed @_ become attributes in the fast-xml-parser style, BadgerFish puts text under a $ key, or everything simply becomes elements. This tool lets you pick the convention and shows the result instantly.
XML needs one thing JSON does not: a single root element. Name it here — and if your JSON is an array or has multiple top-level keys, the output is wrapped and the tool tells you it did so rather than producing invalid XML silently.
Output comes formatted (2 spaces, 4 spaces or tabs) or minified, and JSON produced by the XML→JSON direction round-trips back. Everything runs on your device.
XML has things JSON simply does not: attributes, comments, CDATA sections, processing instructions, namespaces, node order, and mixed text-and-element content. Every converter must choose what to keep, what to rename and what to throw away — which is why several competing conventions exist, and why this tool tells you exactly what each one loses on your document.
- Compact (fxp default) — the fast-xml-parser mapping: attributes become
@_namekeys, text becomes plain values, repeated elements become arrays. Readable and popular; loses order and comments. - BadgerFish — attributes become
@namekeys and element text moves into a$key, so text and attributes never collide. Verbose but unambiguous. - Parker — elements only: attributes are dropped entirely and the root element is absorbed. The cleanest JSON to consume, and the lossiest — this tool counts every attribute it discards.
- Round-trip faithful — an ordered node list that keeps comments, CDATA and processing instructions. Not pleasant to read, but it is the only convention from which the original XML can be rebuilt.
Rule of thumb: converting data (configs, API payloads, exports) — use Compact or Parker. Converting a document you need to reproduce — use Round-trip faithful.