I have been using Node.js exec() with jq/yq/xq to convert XML<->JSON, and comparing the output for XML->JSON with this xml2js to xq, the JSON data returned is different.
Is there a reason for the difference? or a way to configure the output to match?
Edited to add:
let parser = new xml2js.Parser({
attrNameProcessors: [ function (name) { console.log(name); return name } ]
});
the names of the attributes still do not appear to retain the '@' symbol at the beginning. I couldn't find any options that preserve the data to appear exactly identical as the source XML data without modification. Is there something I missed?
I have been using Node.js exec() with jq/yq/xq to convert XML<->JSON, and comparing the output for XML->JSON with this xml2js to xq, the JSON data returned is different.
value of
stdout
appears as:but when using:
the output appears as:
Is there a reason for the difference? or a way to configure the output to match?
Edited to add:
the
name
s of the attributes still do not appear to retain the '@' symbol at the beginning. I couldn't find any options that preserve the data to appear exactly identical as the source XML data without modification. Is there something I missed?