XML to JSON Converter Online

Local only

Parse XML and map its element structure into readable JSON with explicit attribute and text keys.

79 chars · 1 line

Waiting for input

Loading XML parser…

XML to JSON conversion guide

How to convert XML to JSON online

Paste a well-formed XML document into the converter above to map the root element, child elements, attributes, repeated siblings, and significant text into readable two-space JSON. This is useful when an API or development workflow expects JSON rather than XML. This tool is free to use. No account or payment is required.

Last updated

What you can do here

  • XML parser validation before conversion
  • Attributes mapped to @attributes
  • Significant text mapped to #text
  • Repeated siblings mapped to arrays
  • .json result downloads
  • Browser-local processing

Steps

  1. Paste XML or import a .xml text file.
  2. Keep XML → JSON selected in the toolbar.
  3. Fix any XML parser error before conversion can continue.
  4. Copy the JSON result or download it as a .json file.

Understand the XML to JSON mapping

Element names become JSON object keys. Attributes are grouped under @attributes, and significant text uses #text when an element also has attributes or child elements.

When multiple sibling elements share the same tag name, their converted values become a JSON array instead of overwriting one another.

XML and JSON do not have identical data models

The mapping is designed for practical developer conversion, not lossless XML round-tripping. XML namespaces, mixed-content ordering, comments, processing instructions, and schema types do not have direct JSON equivalents in this representation.

Convert locally before using the JSON result

Parsing and conversion happen in the browser. Review the generated structure before using it as an API fixture or application input.

XML to JSON example

Repeated item elements become an array and XML attributes stay visible under @attributes.

XML input

<catalog version="1"><item id="a">Ada</item><item id="b">Linus</item></catalog>

JSON output

{"catalog":{"@attributes":{"version":"1"},"item":[{"@attributes":{"id":"a"},"#text":"Ada"},{"@attributes":{"id":"b"},"#text":"Linus"}]}}

Common questions

Frequently asked questions

How are repeated XML elements converted?

Repeated siblings with the same tag name become an array under that tag name.

How are XML attributes represented?

Attributes are stored under an @attributes object so they remain distinct from child elements.

Is XML to JSON conversion lossless?

No. The formats have different data models, so review namespaces, mixed content, comments, and type assumptions when exact round-tripping matters.

Debugging a specific XML issue? Browse XML troubleshooting.