XML to JSON Converter
Convert XML to JSON online free. Decodes entities properly, keeps IDs and versions exact, strips namespace prefixes, and runs entirely in your browser.
Runs in your browserNothing uploadedFree · no signup
Arrays
Every value stays a string unless you ask for conversion, and even then a number is only written when its digits come back identical — so 007, 1.50 and a 20-digit ID keep every character. Entities such as & and é are decoded, because JSON has no way to write them.
Frequently asked questions
- Why did my list come back as an object instead of an array?
- Because XML has no way to say 'this is a list'. A converter can only look at how many times an element name appears, so two <item> tags become a JSON array and one <item> tag becomes a plain object. That means the shape of your output depends on the data rather than on your schema, and code written to loop over a list breaks the day the list has a single entry. Switch on 'Always arrays' to get an array for every child element regardless of count - it is the option to use whenever something will read the JSON programmatically. The tool also warns you whenever this ambiguity is present in what you pasted.
- How are attributes represented?
- As ordinary keys with a marker in front, so <price currency="USD">44.95</price> becomes { "@currency": "USD", "#text": "44.95" }. The prefix exists because XML lets an attribute and a child element share a name - <book id="1"><id>2</id></book> is perfectly legal - and without a prefix one silently overwrites the other. You can choose @, _, $ or no prefix at all; if you pick no prefix and a collision actually happens, the tool tells you which key was affected instead of losing a value quietly.
- Will my numbers, IDs and version strings survive?
- Yes, because every value stays a string unless you turn on type conversion, and even then a number is only written when its digits come back identical. That keeps a leading zero (007 stays "007"), a trailing zero (a version of 1.50 stays "1.50") and any integer past 2^53 - a 20-digit ID would otherwise be rounded to a double and come back with the last few digits replaced by zeros, which is what a converter built on parseFloat does.
- Can it remove the soap: and ns: prefixes?
- Yes. Turn on 'Remove namespace prefixes' and soap:Envelope becomes Envelope, which makes a SOAP response far easier to navigate in code. The xmlns declarations are dropped at the same time, since the prefixes they define no longer appear anywhere. If removing prefixes would make two different names collide - a:id and b:id both becoming id - the tool says so rather than silently keeping one.
- What gets lost in the conversion?
- Four things, and each one is reported rather than dropped quietly. Comments, processing instructions and the XML declaration have nowhere to live in JSON. Mixed content - an element holding text and tags together, like a paragraph with a bold word in it - loses the order between the text and the tags, because JSON object keys carry no position. Undeclared entities such as are left exactly as written, since only < > & ' and " exist in XML without a DTD. And the array ambiguity described above.
- Is my XML uploaded anywhere?
- No. The XML is parsed and converted entirely in your browser and nothing is sent to a server, so a SOAP response, an API payload or a config file holding hostnames and keys never leaves your device.