How do I make an attribute instead of an element?
Start the key with @: {"book": {"@id": "7", "title": "Dune"}} gives <book id="7"><title>Dune</title></book>. A value under #text becomes the element’s own text, beside its attributes.
Why is my array inside a <root> element?
An XML document has one root element, and an array would make one for each item. So the items go inside <root>, as <item> elements when the array is at the top. Type another name as the Root element to change root.
Will converting the XML back give me my JSON?
The shape, yes, but numbers and true come back as strings, a one-item array as a single value, and a null as an empty string. That is XML’s limit: it holds text and nothing else.
Does the result start with an XML declaration?
Yes: every result starts with <?xml version="1.0" encoding="UTF-8"?>, and the file downloads in UTF-8 to match, so accents and emoji need no escaping.