Convert JSON data into clean, well-formatted XML locally.
Loading tool
About JSON to XML
Convert JSON into well-formed, indented XML. Keys become elements, arrays repeat their parent element, keys prefixed with @_ become attributes and #text becomes element text. You can set the root and array item element names, choose indentation, include or omit the XML declaration, and self-close empty elements; keys that are not valid XML names are sanitized with underscores.
Common uses
- Build an XML payload for a SOAP or legacy XML API from JSON data
- Produce XML test fixtures from JSON samples
- Generate XML with attributes by using @_ prefixed keys
FAQ
- How do I create XML attributes from JSON?
- Prefix the key with @_, for example {"book": {"@_id": "1", "title": "X"}} produces <book id="1"><title>X</title></book>.
- Why does XML need a root element?
- A well-formed XML document must have exactly one top-level element. JSON can have several top-level keys or be an array, so the converter wraps the output in a root element whose name you can set.
- How are JSON arrays represented in XML?
- XML has no array type, so each array item becomes a repeated element with the same name. Top-level and nested arrays without a name use the configurable item element name.