Format
XML to JSON
Paste XML and get JSON. Attributes are prefixed with @. Mixed text uses #text. External entities are not processed.
Input is processed in your browser. DataToolMage does not upload it, store it, or send it to analytics.
Paste structured data. Work stays in this browser.
How it works
A local XML parser maps elements, attributes, and text. Values stay strings so XML numbers are not coerced.
Input and output
Input is XML text. Output is JSON. HTML and binary XML are out of scope.
Common uses
Attribute
<item id="1">tea</item> becomes {"item":{"@id":"1","#text":"tea"}}.
Repeating tags
Sibling <item> elements become a JSON array.
How to use this tool
- Paste well-formed XML.
- Read the mapping notes if attributes or mixed content appear.
- Copy the JSON.
Limitations
- Namespaces are kept as prefix:local strings, not expanded.
- Comments and processing instructions are dropped.
- Pathological nesting is rejected.
Questions
- How are attributes represented?
- An attribute named id becomes @id. This is explicit so attributes are not merged into child elements.
- Are DTDs supported?
- No. DOCTYPE and ENTITY declarations are rejected so entity expansion cannot run.
Related tools
JSON to XML
Paste JSON and get XML elements. Arrays become repeated siblings. A wrapper root is added when JSON has no single root key.
YAML to JSON
Paste YAML maps and sequences and get JSON. Only JSON-compatible types are accepted so implicit YAML 1.1 typing cannot rewrite values.
CSV to JSON
Paste a delimited table and get an array of objects. Delimiters can be detected. Type inference is optional and conservative.