There is no single correct way to turn JSON into XML. The two formats do not model data the same way: XML has attributes, mixed content and no native array type, none of which JSON has an equivalent for. This tool picks one mapping and states it on the page, rather than pretending a natural one exists.
Using the JSON to XML converter
Choose a direction and, when writing XML, a name for the root element, since JSON has nothing that names a document the way an XML root element does. Converting
{"items":[{"name":"A & B <co>"},{"name":"C"}],"note":null}
with the root set to catalog produces:
<catalog>
<items>
<name>A & B <co></name>
</items>
<items>
<name>C</name>
</items>
<note/>
</catalog>
An object member becomes a child element, an array becomes repeated
sibling elements sharing the array’s key as their name, and characters
that are not legal inside XML text, like & and <, are escaped.
Attributes, text, and empty values
A key prefixed with @ becomes an XML attribute on write, and a #text
key becomes text sitting next to child elements. Neither @ nor # is a
legal character to start an XML element name with, so a plain JSON key can
never collide with either convention by accident.
null, an empty object, an empty array, and an empty string all become an
empty element, because XML has exactly one shape for nothing and cannot
distinguish between them. Reading <note/> back therefore returns null
for all four, which the page states plainly rather than leaving you to
discover it.
Why the reader returns every value as a string
XML records no type information at all. A number in an XML document is just digits as far as the format is concerned, and guessing that it should become a JSON number is exactly the kind of guess that turns a postcode into an integer with its leading zero missing. Reading back stays lossless by refusing to guess.
What a repeated element name means coming back
A repeated element name under the same parent becomes a JSON array on the way back, and a member name that is not a legal XML element name stops the conversion and names the offending key, rather than silently mangling it into something that looks like a valid tag.