[{"id":"9f9d3bb8.b2e348","type":"inject","z":"d0d4f76e.209b68","name":"","topic":"","payload":"{\"Element\":[{\"name\":\"element1\"},{\"name\":\"element2\"},{\"name\":\"element3\"}]}","payloadType":"json","repeat":"","crontab":"","once":false,"x":850,"y":740,"wires":[["e6bb1904.842c78"]]},{"id":"e6bb1904.842c78","type":"change","z":"d0d4f76e.209b68","name":"Get scenario topics","rules":[{"t":"set","p":"someGlobal","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":740,"wires":[[]]}]
Now I want to read the Element with name = 'element1' from the array, using a Jsonata expression (by injecting a payload string containing 'element1'):
[{"id":"81465335.1ee9d","type":"debug","z":"d0d4f76e.209b68","name":"Test 3","active":true,"console":"false","complete":"payload","x":930,"y":640,"wires":[]},{"id":"11f58507.7a5a3b","type":"inject","z":"d0d4f76e.209b68","name":"","topic":"","payload":"element1","payloadType":"str","repeat":"","crontab":"","once":false,"x":440,"y":440,"wires":[["891f4e86.2f6c3","bc086635.acdd88","b39b0120.4082c"]]},{"id":"b39b0120.4082c","type":"change","z":"d0d4f76e.209b68","name":"Get element by hardcoded name","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"someGlobal\").Element[name=payload]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":640,"wires":[["81465335.1ee9d"]]},{"id":"efb67387.f475d","type":"debug","z":"d0d4f76e.209b68","name":"Test 2","active":true,"console":"false","complete":"payload","x":930,"y":540,"wires":[]},{"id":"bc086635.acdd88","type":"change","z":"d0d4f76e.209b68","name":"Get element by name in payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"someGlobal\").Element[name='element1']","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":540,"wires":[["efb67387.f475d"]]},{"id":"891f4e86.2f6c3","type":"change","z":"d0d4f76e.209b68","name":"Get name in payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":440,"wires":[["ee9e7b40.25ebb8"]]},{"id":"ee9e7b40.25ebb8","type":"debug","z":"d0d4f76e.209b68","name":"Test 1","active":true,"console":"false","complete":"payload","x":930,"y":440,"wires":[]},{"id":"755ed4c5.e1948c","type":"comment","z":"d0d4f76e.209b68","name":"payload","info":"","x":610,"y":400,"wires":[]},{"id":"f5f1cfa0.df0d8","type":"comment","z":"d0d4f76e.209b68","name":"$globalContext(\"someGlobal\").Element[name='element1']","info":"","x":770,"y":500,"wires":[]},{"id":"cda74f2d.75d07","type":"comment","z":"d0d4f76e.209b68","name":"$globalContext(\"someGlobal\").Element[name=payload]","info":"","x":760,"y":600,"wires":[]}]
Kind regards,
Bart
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/05b246b0-93d8-42fa-ab23-2f406ff79b75%40googlegroups.com.

You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/XsFspG-1p_k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/CAF%3DvhqdjrSC7jtxOJnSrQ8G7QDFfzm3XQ-hxvmvCCq6Q68%2BJxw%40mail.gmail.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/CANE1cgsrumsyxOs7TCNLohmOwGo9DrY0-SCExcra9KpzFLCLQw%40mail.gmail.com.