How elements become JSON
The root element becomes the single top-level key. A child that appears once becomes an object property; children with the same name that repeat are collected into an array. An element that holds only text becomes a plain value.
- Attributes become prefixed keys such as
@id - Text next to child elements or attributes goes in
#text - CDATA sections are kept as ordinary text
- Comments and processing instructions are dropped