Skip to content

Missing support for array conversion #181

@hazaart

Description

@hazaart

In case a node exists multiple time in the same parent, it will automatically be converted to a JS array.
If the node occurs only once however in the dataset (eventhough it could occur multiple times in theory), the conversion will create an object cause it has no way of knowing it should convert it to an array.
Other libraries have support for this by adding an array in the parsing options containing a list of elements that always need to be converted to an array.
Example https://github.com/abdolence/x2js has support via 'arrayAccessFormPaths'.

I am surprised this basic conceptual issue in xml to json conversion is not yet covered by this widely used library. Makes for a lot of painful checks on the output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions