Wondering which format fits your use case? Read JSON vs YAML vs XML: when to use which.
Conventions used
{ "@id": "1", "#text": "hi" }→<tag id="1">hi</tag>{ "item": [1, 2, 3] }→<item>1</item><item>2</item><item>3</item>null→ self-closing element
When you need JSON converted to XML
XML still rules whole categories of software: SOAP services, RSS/Atom feeds, OOXML documents, Android resource files, and most enterprise messaging. Converting JSON to XML lets a JSON-native client talk to systems that haven't moved off SOAP or that demand schema-validated XML. If you're comparing the formats on their merits, see JSON vs YAML vs XML: when to use which.
FAQ
Is JSON to XML lossless?
Can I customize the root element?
<root>. A custom root name option is on the roadmap.