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.
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
- Paste the XML
Include the whole document, from the first tag to the last.
- Read the JSON
It updates as you type.
- Save the result
Copy it or download data.json.
Questions about XML to JSON
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.