XML ⇄ JSON

Convert XML to JSON with the browser built-in parser

How to use

Same-name child elements are merged into an array automatically; XML attributes go in @attributes and plain text nodes go in #text. This is a common convention, not the only standard.

FAQ

Is there information loss during conversion?

Details such as XML comments, processing instructions and CDATA boundaries are lost; only elements, attributes and text are kept. That is enough for most data conversions.

Where did the attributes go?

They are collected into the @attributes object. This tool does not read that field when generating XML back, so handle it yourself if needed.