Hacker News new | ask | show | jobs
by cryptonector 2230 days ago
And... it's wrong and busted. The children nodes of an XML node have to be represented as an array in JSON, not as an object. The only things in XML that can be represented as JSON objects (unless your converter is Schema-aware) are attributes, and PIs.

If your converter is aware of XML schemas, then child nodes that have cardinality one or zero-or-one and which have no ordering dependency relative to sibling nodes can be gathered into an object. It's just easier to use arrays for children nodes.

Put it this way: this tool, applied to a document, will butcher it.