Features
- Predictable mappingAttributes use @name and mixed text uses #text.
- Well-formed checkInvalid XML is reported instead of half converted.
- Runs on your deviceYour data is processed in the browser and is never uploaded.
How to use the XML to JSON converter
- Paste XML or open a file.
- Review the JSON.
- Copy or download it.
There is no single standard
XML and JSON model data differently. Element order between different tag names, comments and namespaces declarations may not carry over as you expect, so check the result.
Parse XML in the browser
const doc = new DOMParser().parseFromString(xml, 'application/xml');
const items = [...doc.querySelectorAll('item')].map((el) => el.textContent);
Frequently asked questions
Are numbers converted?
No. XML has no types, so values stay strings.
Why is one item not an array?
Only elements that appear more than once become arrays.
Are comments kept?
No.