Converters
XML to JSON Converter
Turn an XML document into JSON.
XML0 chars
JSON
Guide & explanation
The XML to JSON Converter turns an XML document into a JSON object.
Mapping rules
| XML | JSON |
|---|---|
Attribute id="1" | Property "@id": "1" |
| Text in a mixed element | Property "#text" |
| Repeated elements with the same name | Array |
| Element containing only text | A plain string value |
Example
<book id="bk1"><title>XML</title><tag>a</tag><tag>b</tag></book>
{ "book": { "@id": "bk1", "title": "XML", "tag": ["a", "b"] } }
Options
- Detect numbers & booleans — converts text
42/trueinto JSON types. Turn it off to keep everything as strings.
XML has no notion of arrays or numbers, so a round-trip is not always identical.