BRev Free Tools
At BRev Digital, essentials should be a right — free, forever.
Open in workspacekeep several tools open at once
All tools
XML tools

XML to JSON

There is no canonical XML-to-JSON mapping: XML has attributes, comments, CDATA, namespaces and ordered mixed content, and JSON has none of them. Every converter chooses what to keep — this one makes the choice yours, with four conventions side by side and a live report of exactly what each loses on your document.

The subtlest bug in this conversion is the single-vs-array trap: an element that appears once becomes an object, twice becomes an array — so code written against one sample breaks on the next. The tool detects elements that repeat under one parent but not another and offers to pin them as always-arrays.

Hostile XML stays inert — DOCTYPE entity definitions are never processed, so billion-laughs payloads do nothing — and your document never leaves the browser.

or paste / drop a file
Mapping convention — every choice keeps and loses different things
XML input
JSON output
Formatted and converted on your device — nothing is uploaded. External entities and DOCTYPE definitions are never processed, so hostile XML (e.g. billion-laughs payloads) stays inert.
There is no canonical XML ⇄ JSON mappingwhy this tool asks you to choose

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 @_name keys, text becomes plain values, repeated elements become arrays. Readable and popular; loses order and comments.
  • BadgerFish — attributes become @name keys 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.