Abdul Waheed
Abdul Waheed

Reputation: 403

How to access XML value in Node-RED

I have a web service response in XML. I want to extract the 'available' tag value in node-red. I have placed the XML node before a function node and I tried accessing the value as msg.payload.agentAvailability.available in my function. It ends while reporting an error undefined.

enter image description here

This is how my node-red flow looks like. enter image description here

Any help will be appearciated.

Upvotes: 1

Views: 394

Answers (1)

hardillb
hardillb

Reputation: 59608

You have missed out the $ key in your path.

Try the following:

msg.payload.agentAvailability["$"].available

Upvotes: 1

Related Questions