Want a Custom tool for Yourself?

Need a Custom Tool? We build custom tools that can save hours per employee per day.

XML to JSON

Convert XML to JSON instantly. Paste XML, get JSON output with a clean structure, and copy the result for apps and APIs. Great for quick QA.

XML to JSON



Last updated: April 20, 2026

Created by: Eon Tools Dev Team

Reviewed by: Sugam Baskota



What this does

So you have got XML but your code would much rather work with JSON. This converts it. Paste your XML, click Convert, and you get a JSON version with a clean, indented structure, ready to copy into your app.

How to use it

  1. Paste your XML into the box.
  2. Click Convert.
  3. Copy the JSON output with the Copy button.

How it works

The conversion uses a library called X2JS. It reads your XML and turns each element into a JSON property, with the element's content as the value, then nests child elements as nested objects. The result is laid out with two space indentation so it is easy to read. It all runs in your browser, so the XML you paste is not sent anywhere.

How XML maps onto JSON

XML and JSON do not line up perfectly, so there are a few conventions worth knowing so the output makes sense. Element names become the keys, and the text inside an element becomes its value. Attributes are kept too, and they appear as properties with a leading underscore, which is how the conversion tells an attribute apart from a child element. And when a tag repeats several times, those repeats become an array, so a list of items in XML comes out as a JSON array.

Knowing those rules makes the shape of the result predictable. It is worth remembering that there is no single official way to map XML onto JSON, so this is one sensible convention rather than the one true answer.

Questions people ask

How are attributes represented?

As properties with a leading underscore in front of the name, which keeps them distinct from child elements in the JSON.

What happens to repeated elements?

When the same tag appears more than once, those repeats are grouped into a JSON array, so a repeating list in XML becomes an array of values.

Why is the JSON shaped the way it is?

There is no single standard for turning XML into JSON, so the tool follows one consistent convention. Once you know how elements, attributes, and repeats are handled, the structure is predictable.

Is my XML uploaded?

No. It runs in your browser, so nothing you paste leaves your machine.

References

  1. World Wide Web Consortium. Extensible Markup Language (XML) 1.0. https://www.w3.org/TR/xml/


Sugam Baskota

Sugam Baskota is a senior software engineer and Computer Science graduate from UT Arlington, with interests in user scripts, browser extensions, developer tooling, and productivity systems. He spends time building practical utilities and extensions in the kinds of workflows Eon is designed to simplify. At Eon Tools, he reviews useful, password, and developer tools.