Skip to content
Cifrivo
Developer

Convert XML to JSON

Convert XML elements, attributes, text and repeated sibling nodes into an inspectable JSON representation entirely in the browser.

Processed locallyYour files never leave your device.

Everything is processed locally in your browser.

How it works

  1. Paste XML or choose a .xml file.
  2. Press Convert after the document validates.
  3. Review the formatted JSON output.
  4. Copy or download the JSON file.

Practical example

<book id="7"><tag>web</tag><tag>tools</tag></book> keeps id under @attributes and represents the two tag nodes as an array.

Formula and explanation

XML and JSON have different data models. XML supports attributes, mixed text and repeated elements, so there is no single universal conversion. Cifrivo uses explicit @attributes and #text keys and groups repeated siblings into arrays.

An element containing only text becomes that text directly. This keeps ordinary documents concise while retaining structure when attributes or child elements appear.

Namespace prefixes remain in element names. The result is intended to be predictable and reversible with Cifrivo's JSON to XML conventions, though mixed-content order may need domain-specific handling. Conversion is local.

Frequently asked questions

How are XML attributes represented?

They are grouped inside an @attributes object on the corresponding element.

What happens to repeated elements?

Repeated sibling names become a JSON array in their original order.

Can every XML document map perfectly to JSON?

No. Mixed content, namespaces and comments have semantics JSON cannot express universally; inspect the output for complex documents.