Converts XML to JSON with an explicit convention: attributes get an “@” prefix, text of an element with attributes or children goes into “#text”, repeated elements become an array and empty elements become null.
Because XML and JSON are not equivalent, the tool tells you what is lost: relative order across differently named elements, text position in mixed content, comments and namespace resolution.
How to use it
- Paste the XML.
- Pick the indentation.
- Press Run and review the information-loss warnings.
Example
<order id="42"><customer>Ana</customer><item sku="A-1">Teclado</item><item sku="B-2">Ratón</item><gift/></order> {
"order": {
"@id": "42",
"customer": "Ana",
"item": [
{
"@sku": "A-1",
"#text": "Teclado"
},
{
"@sku": "B-2",
"#text": "Ratón"
}
],
"gift": null
}
}
Limitations
- All values are strings: numbers and booleans are not inferred.
- An element appearing once is not an array even if other documents repeat it.
- Namespace prefixes are part of the name; they are not resolved to their URI.
FAQ
- Can I go back from this JSON to the original XML?
- Not always: order across different siblings, comments and mixed-text position are lost. Use it to read data, not as a round-trip format.
- Why are numbers not converted?
- Because everything in XML is text, and guessing types can change data such as postal codes or IDs with leading zeros.