node-red variable assignment

266 Views Asked by At

I have a debug node that can correctly print

msg.payload.tns:Envelope.tns:Body[0].WX:RetrieveClaimDetailsResponse[0].WX:claimFolder[0].WX:underlyingAgreements[0].WX:policyNumber

(I've used a xml node to convert from xml to json)

but in a function node, I can't assign this value to a variable

I thought I could try something like

var policyNumber = msg.payload.["tns:Envelope"].["tns:Body"][0];// (...)

but I am getting a syntax error

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

You should actually use

var policyNumber = msg.payload["tns:Envelope"]["tns:Body"][0];