Leonidas-from-XIV / node-xml2js

XML to JavaScript object converter.
MIT License
4.87k stars 601 forks source link

How to exclude XML tags when the corresponding JSON value is "undefined"? #572

Open FrankMartinezSRC opened 4 years ago

FrankMartinezSRC commented 4 years ago

As the title says, I am looking to have the conversion from JSON to XML result in the exclusion of a tag for any JSON property which has an undefined value. For example, if the JSON in relevant part reads like so:

{ foo: undefined }

I am looking for a way to exclude the production of <foo></foo> or <foo/> tags.

Perhaps I misread the documentation but I don't see an option for doing so; or is it already built into the package?

Thanks in advance.