The element name that wraps the document when converting from JSON.
3
Copy the result
Invalid XML is reported with the parser's own message, not passed through.
The mapping rules
An object key becomes an element. A key that starts with @ becomes an attribute on its parent, and a key called #text becomes the element's text. An array repeats the element name, because XML has no array type: three items in a tag array become three <tag> elements.
Reading in the other direction applies the same rules. Attributes become @name keys, text becomes #text only when there are also child elements or attributes, and repeated sibling names become an array. It is a convention, not a standard; every JSON-to-XML tool picks a slightly different one, so check the shape against the API you are feeding.
Why XML to JSON is lossy
XML has things JSON cannot express: mixed content (text and elements interleaved), namespaces, processing instructions, comments and attribute order. This converter keeps attributes and child elements and drops the rest, which is the usual compromise but means a round trip is not identity.
Namespaces are the sharpest edge. A prefixed element such as soap:Body is kept by name, but the namespace URI is lost, so a consumer that checks namespaces will reject the JSON. If you need to preserve them, keep the original XML and convert only the fields you need.
Roots, escaping and validation
JSON to XML needs a single root element, because XML allows exactly one. The root name defaults to root and can be changed; an array at the top level becomes a root with repeated item children. Text and attribute values are escaped, so an ampersand in a string becomes & rather than breaking the document.
XML to JSON uses the browser's own XML parser and reports a mismatched tag as an error instead of guessing. For a pure XML tidy-up, the XML formatter indents without changing the data; for YAML, use the JSON and YAML converter.
Frequently asked questions
How are attributes represented?A key starting with @ becomes an attribute, so @id becomes id="…" on the parent element.How are arrays represented?By repeating the element name. The reverse direction turns repeated siblings into an array.Are namespaces preserved?No. The prefixed name is kept but the namespace URI is lost, so round trips are not exact.Is CDATA preserved?It is read as text and written back as escaped text, not as CDATA.Is my data uploaded?No. Both directions run in this browser tab.What happens with invalid XML?The browser's parser reports the error and the tool shows its message; nothing is silently converted.