How JSON maps to XML
- Each key becomes an element:
{"name": "Ada"}→<name>Ada</name>. - Arrays become repeated elements with the same name; a top-level array uses
<item>. nulland empty objects become empty elements (<plan/>).- Keys that aren't valid XML names (spaces, leading digits) are adjusted —
2fabecomes_2fa. &,<and>in values are escaped.
What doesn't carry over
JSON has no attributes, namespaces or mixed content, so the output uses elements only. JSON types are also lost — in XML, 42, true and "42" all become text. If a system needs attributes or a schema, adjust the output by hand or with XSLT.


