Turn a JSON payload into XML for a legacy API

The integration wants XML but your data is JSON. Convert the structure — elements, arrays, escaping — without hand-writing tags.

Tools used in this guide

The job

SOAP-era endpoints and older enterprise APIs still want XML. A JSON object maps mechanically: keys become elements, nested objects nest, arrays repeat the element name.

Paste, name the root, copy

Paste the JSON and set a root element name. Objects become children; arrays become repeated sibling elements; a top-level array becomes <item> children of the root. Keys that aren't valid XML names become <item>.

  • Output is always a single-root XML document with an XML declaration.
  • Special characters (& < > " in text, & < in names) are escaped automatically.

What doesn't carry over

JSON types collapse to text — numbers and booleans become their string forms. Attributes exist only through the @ convention: {"@id": 3} on an object emits id="3" on the element, and "#text" sets its text. Anything without those markers becomes a child element.