Skip to content
This repository has been archived by the owner on Jan 7, 2021. It is now read-only.

documentation for arrayNotation individual fields #189

Open
z1haze opened this issue Feb 15, 2020 · 1 comment
Open

documentation for arrayNotation individual fields #189

z1haze opened this issue Feb 15, 2020 · 1 comment

Comments

@z1haze
Copy link

z1haze commented Feb 15, 2020

Hi, the documentation says that you may specify the array notation on a per field basis, but does not describe how that is done? Can you please provide that info?

It mentions:
arrayNotation: XML child nodes are always treated as arrays NB: you can specify a selective array of nodes for this to apply to instead of the whole document., however this is not true. A child node with a single element is returned as an object. How could i force this individual field to always return as an array even if only a single element exists within?

@aquu
Copy link

aquu commented Mar 10, 2020

I was also looking for documentation on this but couln't find it. However, in the tests you can see an example:
var result = parser.toJson(xml, {arrayNotation: ['drivers', 'vehicles']});

You can just specify the "always array" fiedlds as array.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants