Developer Tools

XML to JSON Converter

Turn XML into clean JSON, keeping attributes and grouping repeated tags.

Rate this tool
XML
JSON

How to use the XML to JSON Converter

  1. Paste your XML on the left.
  2. The JSON appears on the right, with attributes prefixed by @.
  3. Copy the result.

About the XML to JSON Converter

The XML to JSON Converter reads XML and produces clean, readable JSON. It uses your browser built-in XML parser, so it understands the same well-formed markup a real application would. Element text becomes JSON values, and the nested structure of your document is preserved as nested JSON objects.

Two details make the output practical to work with. Attributes are kept rather than discarded, prefixed with an @ so you can tell them apart from child elements. And when a tag repeats inside its parent, those repeats are grouped into a JSON array, which is exactly how you would expect a list to look. If your XML is malformed, the tool reports the problem instead of guessing, so you are never handed silently broken output.

Everything runs locally in your browser, so your XML is never uploaded. Paste on the left, read the JSON on the right, and copy it when you are happy. To convert in the opposite direction use the JSON to XML Converter, and for tabular exports the JSON to CSV Converter pairs well with this workflow.

Frequently asked questions

How are XML attributes handled?

Attributes are preserved in the JSON and prefixed with an @ symbol. That keeps them clearly separate from child elements, so no information from the original XML is lost during conversion.

What happens when a tag appears more than once?

Repeated tags inside the same parent are grouped into a JSON array. This matches how lists are normally modelled in JSON, so collections come through in a form your code can loop over directly.

What if my XML is malformed?

The tool relies on the browser XML parser, so invalid markup is reported rather than converted. You get a clear signal that something is wrong instead of misleading, silently broken JSON.

Is my XML sent to a server?

No. Parsing and conversion happen entirely in your browser. Nothing is uploaded, so it is safe to convert documents that include confidential data.

Can I get the original XML back from the JSON?

You can convert JSON back to XML with the JSON to XML Converter, but because attribute prefixes and array grouping change the representation, a round trip may not reproduce your source XML exactly.