I have a msg
and I'd like to extract the value of col1 using JSONata and as usual - not being successful
present (not working attempt)
payload[0].col1
I have a msg
and I'd like to extract the value of col1 using JSONata and as usual - not being successful
present (not working attempt)
payload[0].col1
payload.0.col1 ?
[EDIT]
payload["0"].col1
Tip: share the JSON object as text (not as an image) so that we can test the JSONata query in https://try.jsonata.org/
at first sight I would expect your JSONata being correct but can't test it.
As I said above in my edit.
[{"id":"83bd3483.dd4038","type":"inject","z":"46eb32e6.39048c","name":"","topic":"","payload":"[{\"col1\":\"Seven missed voilce calls\",\"col2\":\"Note3\"}]","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":60,"wires":[["9ec88448.5bca88"]]},{"id":"9ec88448.5bca88","type":"change","z":"46eb32e6.39048c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[\"0\"].col1\t\t\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":60,"wires":[["f4f0bd72.cd2fe"]]},{"id":"f4f0bd72.cd2fe","type":"debug","z":"46eb32e6.39048c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":590,"y":60,"wires":[]}]
Turns out I had a logic fault because I forgot that my text wasn't in msg.payload but in msg.oldPayload #NogginMe
Both
oldPayload[0].col1
and
oldPayload["0"].col1
work fine
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.