What is the XML to JSON Converter?
Many older APIs, RSS and Atom feeds, SOAP services, sitemaps and configuration files still use XML, while modern code expects JSON. This XML to JSON converter turns an XML document into a JSON object you can use directly in JavaScript, Python or a database.
Attributes become keys with an @ prefix, elements that repeat become arrays, and text next to attributes is stored as #text. CDATA sections are read as plain text. Parsing uses your browser's strict XML parser, so you also get a precise error if the XML is not well formed.
How to use the XML to JSON Converter
- Paste your XML, or click Sample.
- Click Convert to JSON.
- Optionally tick Always use arrays for a predictable shape, or Detect numbers & booleans.
- Copy the JSON.
Frequently asked questions
How are XML attributes represented?
As keys starting with the attribute prefix, @ by default. <price currency="USD">5</price> becomes {"@currency": "USD", "#text": "5"}. You can change or remove the prefix.
Why is one element an object and another an array?
An element that appears once becomes an object, and one that repeats becomes an array. If your code needs the same shape every time, tick Always use arrays.
Are numbers converted automatically?
Not by default, because values like ZIP codes or IDs with leading zeros would change. Tick Detect numbers & booleans to convert plain numbers and true/false.