# XML to JSON

> XML to JSON converts XML, such as RSS feeds, sitemaps, SOAP replies and older config files, into JSON that is easier to use in JavaScript and modern APIs.

Page: https://ishowpdf.com/tools/xml-to-json

## What XML to JSON does

XML to JSON converts XML, such as RSS feeds, sitemaps, SOAP replies and older config files, into JSON that is easier to use in JavaScript and modern APIs.

Element names become keys. Attributes become keys that start with @, such as @id. When an element has both attributes and text, the text goes into a #text key. Repeated elements with the same name are gathered into a list. The root element stays as the top key, so nothing is lost at the outer level. If the XML is not well-formed, you are told so instead of getting half a result.

## How to use XML to JSON

1. **Paste the XML**: Include the whole document, from the first tag to the last.
2. **Read the JSON**: It updates as you type.
3. **Save the result**: Copy it or download data.json.

## Questions

**How are XML attributes shown in JSON?**

Each one becomes a key starting with @. An attribute called id becomes a key named @id holding the same value.

**Why is a single item not in a list?**

Only repeated elements become lists. An element that appears once is a plain value, so your code may need to handle both shapes.

**Are namespaces and comments kept?**

Comments are dropped. Prefixed names, such as soap:Body, are kept as written in the keys.

More free tools: https://ishowpdf.com/tools
