Convert XML to JSON: SOAP responses, RSS feeds, sitemaps, Maven or Android config files. Each element becomes a key, and an element that appears more than once under the same parent becomes an array.


Attributes are written as @name, and text that sits next to attributes or child elements is written as #text, the convention most libraries use. CDATA is kept as text; comments and processing instructions are dropped. Values stay strings unless you turn on Convert numbers and booleans; values with leading zeros, like zip codes, always stay text.


The XML is parsed in your browser, nothing is uploaded, and malformed XML is reported with the tag that broke it. To pretty-print or minify XML instead, use the XML Formatter .

Frequently asked questions

How are XML attributes represented in JSON?

Each attribute becomes a key prefixed with @, so <book id="1"> becomes {"@id": "1"}. Text that sits next to attributes or child elements is stored under #text.

When does an element become an array?

When the same element name appears more than once under one parent. A single <item> stays an object, while two or more become a list, which is how most XML-to-JSON libraries behave.

Are numbers converted automatically?

Only if you turn on "Convert numbers and booleans". XML has no types, so by default every value stays a string. Values with leading zeros, such as zip codes, always stay strings.

Related tools