JSON to XML Converter
Convert JSON to XML or XML to JSON online. Attributes use @ and repeated elements become arrays, so the result is predictable both ways.
0 characters0 bytes
0 characters0 bytes
Attributes use @ (as in "@id"), and text next to child elements uses "#text". Repeated elements become arrays.
How to Use It
- Choose the direction.
- Paste the JSON or the XML.
- Copy the output.
Questions and Answers
Where do XML attributes go?
Each attribute becomes a key with the @ prefix: <book id="1"> becomes {"book": {"@id": "1"}}.
Is my XML uploaded?
No. The XML is read with the browser's own parser, which does not load external entities.
Good to Know
Comments, processing instructions, and namespaces do not survive in JSON. One element alone does not become an array, so the JSON shape depends on the number of elements. Invalid XML names get _ in place of the bad characters.
Related Tools
- XML Formatter and ValidatorPretty-print XML with clean indentation, minify it, or check that it is well-formed. An error shows its line and column.
- JSON Formatter and ValidatorPretty-print or minify JSON, or find its errors with the line and column.
- JSON and YAML ConverterConvert JSON to YAML or YAML to JSON. Several YAML documents become one JSON array.
Source code of this tool (opens in a new tab)Report a problem on GitHub (opens in a new tab)