Conversion rules
- An object with a single key becomes the root element; otherwise everything is wrapped in
<root>. - Keys starting with
@become attributes; a#textkey becomes the element’s text. - An array repeats the element once per item.
nullbecomes an empty element<key/>.- Characters not allowed in XML names (spaces,
$) are replaced with_, and names cannot start with a digit.
Special characters in values (&, <, >, quotes) are escaped, so the output always parses.