More
More
JSON ↔ XML Converter
Convert between JSON and XML.
Free. Runs in your browser: nothing you enter or open is uploaded.
The rules: a key starting with @ is an attribute, the key #text holds an element's text next to attributes or children, and an array becomes the same element repeated. When there is more than one top-level key, the XML is wrapped in a root element. Comments, processing instructions and the DOCTYPE are skipped when reading XML, and entities other than the five standard ones are not expanded.
How to use it
- Choose JSON to XML or XML to JSON.
- Paste your data. The result updates as you type, and errors show the line and column.
- Copy or download the result, or press Swap to convert it back.
Questions
How are XML attributes shown in JSON?
As keys that start with @, so id="b1" becomes "@id": "b1". When an element has attributes and text, the text goes under the key #text.
How are repeated elements handled?
Two or more child elements with the same name become a JSON array. A single child stays a plain value, which is the usual convention but means one item and two items look different.
Why are my numbers strings after converting XML?
XML has no data types: everything is text. Tick the option to read values that look like numbers or true and false as real JSON values.
Is my file uploaded?
No. The conversion runs entirely in your browser, and XML entity tricks such as external entities are never followed.