XML to JSON Converter
Paste XML to get an equivalent JSON object, or paste JSON to build XML from it. Toggle whether attributes are included.
About this tool
APIs and integrations frequently need to bridge the two formats: a SOAP or RSS response has to become JSON for a JavaScript front end, or a JSON payload must be turned into XML for a legacy system. The conversion maps elements to keys, repeated elements to arrays, attributes to keys prefixed with @_ and text content beside attributes to #text.
Values that look like numbers or booleans are parsed as such; strings are kept otherwise. When converting JSON to XML, an object with a single top-level key becomes the root element; anything else is wrapped in a root element. The converter is fast-xml-parser, which runs entirely in your browser.
Frequently asked questions
- Why do some values become arrays and others not?
- An element that appears once becomes a value; the same element repeated becomes an array. That is inherent to mapping XML onto JSON.
- How do I keep attributes?
- Leave the attributes checkbox on. They appear as keys starting with @_.
- Is the conversion lossless?
- Comments, processing instructions and element order across mixed content are not preserved. Data-oriented XML converts cleanly.