Code Tower · room 19

JSON to XML

Convert JSON to XML.

🔒 Processed in your browser · No upload · No sign-up

Convert JSON to XML

Turn JSON objects into well-formed XML for SOAP services, RSS feeds, Android resources or legacy systems that only accept XML. Object keys become elements, arrays become repeated elements, and keys starting with the attribute prefix (by default @_) become XML attributes.

Example

{"book": {"@_id": "42", "title": "Dune"}}

becomes

<book id="42">
  <title>Dune</title>
</book>

Why do I need a root element?

An XML document must have exactly one root element. If your JSON has several top-level keys (or is an array), it is wrapped in the root element you choose. If it has a single top-level key, that key is used as the root.