Problem XML to JSON data converted


When I am converting the XML to JSON and when I try to extract data from JSON I am getting errors and when I did some searching it lead me to the Data is not parsing correcelty in JSON format.

I am try to extract specific data using CODE and this what I have wreiten :smile:

const hostList = $input.json[“HOST_LIST_VM_DETECTION_OUTPUT”][“RESPONSE”][“HOST_LIST”][“HOST”];
const endResult = [];

for (let i = 0; i < hostList.length; i++) {
“ID”: hostList[i][“ID”],
“IP”: hostList[i][“IP”],
“NETBIOS”: hostList[i][“NETBIOS”],

return endResult;

Any one help me with this

Hi @techbrooks, I am sorry to hear you’re having trouble.

Perhaps you can confirm which data you are passing on to your Code node and which error exactly you are seeing? Testing your snippet with a generic workflow including made up data like below is working fine for me (on [email protected]) once I swap in suitable variables from this list and wrap it around the example code looping through items:

This would be the result:

Thank You very much for your reply I have resolved my problem watched one of the n8n youtube video where they explain how to use the javascript in n8n and I was able to work with it.

Thank You again for looking into it.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.