All tools
X→

XML → JSON

Parse an XML document into a clean JSON object.

JSON & data
input.xml
0 lines · 0 chars
output.json
0 lines · 0 chars
Overview

About this tool

Parse an XML document into a clean, predictable JSON object — useful for working with XML-based APIs, RSS/Atom feeds, or legacy config files in a language or tool that's easier to work with in JSON.

01

How elements become JSON

Each XML element becomes a JSON object keyed by its tag name. A tag that repeats under the same parent (like several <item> elements in a row) becomes a JSON array automatically, rather than JSON overwriting all but the last one — the same convention JSON → XML uses in reverse.

02

Attributes and text content

XML attributes are pulled out as keys prefixed with "@" (id="42" becomes "@id": "42"), and any text sitting directly inside an element alongside child elements or attributes is placed under a "#text" key, so nothing from the original document is silently discarded.

Frequently asked questions

What happens to XML comments or processing instructions?

They're not part of the data model and aren't included in the JSON output — only elements, attributes, and text content are converted.

Does it handle deeply nested XML?

Yes — the conversion is recursive, so elements nested at any depth convert the same way, each becoming a nested JSON object or array in the output.