EasyConvert

XML to JSON Converter

Convert XML into JSON — the format most modern APIs and programs prefer. Paste an XML document and the converter turns elements into JSON objects, repeated elements into arrays, and attributes into @-prefixed keys. It runs entirely in your browser, so your data is never uploaded anywhere.

Paste XML and press Convert.

How to use this converter

Paste your XML and press 'Convert to JSON'. The JSON appears below, formatted with indentation — press Copy to copy it. If the XML is invalid, the tool shows the error instead of guessing.

Formula

Each XML element becomes a JSON object: Ali becomes {"name": "Ali"}. Repeated elements become arrays: two elements become "item": [{...}, {...}]. Attributes are stored with an @ prefix: becomes {"item": {"@id": "1"}}. Text inside an element with children goes in #text.

XML is still everywhere — RSS feeds, sitemaps, old APIs, Office files — but JSON is easier to work with in code. Converting by hand is slow and error-prone, especially with nested elements. This converter handles nesting, repeated tags and attributes, and tells you plainly if the XML is broken.

XML → JSON — examples

FromEquals
Ali{"name": "Ali"}
12{"a": {"b": ["1", "2"]}}
x{"item": {"@id": "1", "#text": "x"}}
{"empty": ""}

Frequently asked questions

How do I convert XML to JSON?

Paste the XML above and press 'Convert to JSON'. The result appears formatted — press Copy to copy it.

How are attributes handled?

Attributes become keys with an @ prefix: becomes {"item": {"@id": "1"}}. That keeps them separate from child elements.

What happens with repeated elements?

They become a JSON array: two elements under one parent become "item": [first, second].

What if my XML is invalid?

The converter shows the error message instead of guessing — fix the XML (usually an unclosed tag) and try again.

Is my data sent anywhere?

No. The conversion runs entirely in your browser — your data never leaves your device.