I'm trying to get the switch node to read in a json message from a sigfox callback and send a twillio message based on the data.
The messages can be of 3 types:
first type:
{
"data":"{c0}"
}
second type:
{
"data":"{c0ff}"
}
third type:
{
"data":"{c0ffee}"
}
what setup of the switch node would allow me to route the messages based on the data content. I tried the most logical combinations to my mind but I either get no routing or all 3 are routed.
*note : the message data is in hex I don't know if that changes anything If it does I can change it.
Any help would be greatly appreciated
Right, so the payload is not JSON (which is a string) but is a javascript object. So in the switch node you just need, for example msg.payload.data == "c0ff"
No JSON involved.
It looks like the property should be set to msg.payload.data rather than just msg.payload, and then you would just compare with strings (not JSONata) - i.e. == c0, contains c0ff, or == c0ffee (it doesn't look like this last one should be a JSONata expression). Note that "c0ffee" would match the 2nd and 3rd case, so the result would depend on whether you have "checking all rules" or "stopping on first match" (in which case the 3rd would never occur).