How do I extract the property payload.common.states["2"]
from an object, referring to the val .
{"common":{"states":{"0":"idle","2":"water leak detected"}},"val":2}
A function node with the following code is working:
msg.payload = msg.payload.common.states[msg.payload.val];
return msg;
A Change Node with JSONATA does not work.
is payload.val a string then I get always the object:
is payload.val a number I get undefined.
Is there a possibility to use a change node to set the payload to the common.states property of payload.val?