XML to JSON

Paste XML and convert it into pretty JSON. Attributes are kept under @attributes, repeated tags become arrays and nothing is uploaded.

Loading…

About the XML to JSON converter

This tool converts an XML document into a JSON object so the structure is easier to inspect or reuse in JavaScript. The root element becomes the top-level JSON key, attributes are stored under @attributes, repeated child tags become arrays, and text content is kept as values or under #text when mixed with child elements.

How to use it

  • Paste well-formed XML into the input area.
  • Pick two or four spaces for the JSON indentation.
  • Copy the generated JSON into your code, fixture or notes.

XML and JSON model data differently, especially around attributes, namespaces and mixed text content, so review the output before using it in production. The conversion is meant for inspection and practical data wrangling, not as a schema-aware mapper. It runs entirely in your browser, so your XML is never uploaded.

Vanliga frågor

How are XML attributes represented in JSON?

Attributes are placed in an @attributes object on the element they belong to, keeping them separate from child tags.

What happens when XML has repeated child tags?

Repeated tags with the same name are converted to an array, so lists such as multiple item elements stay grouped correctly.

Does XML to JSON preserve namespaces?

Namespaced element and attribute names are kept as parsed names, but namespace declarations are still XML-specific, so check the output for your use case.

Is the XML sent to a server?

No. The parser and converter run locally in your browser, so your XML never leaves your device.

Relaterade verktyg