Thats my problem - its usually easier/takes less time to do simple stuff in JSONata ....and then I want to do more .........and more.....
I think you have to have a particular sort of brain to cope with the more subtle uses of JSONata
and I am not sure that I do.
[0,0,0,25,115,101,110,115,111,114,45,117,112,100,97,116,101,32,34,99,111,117,110,116,34,32,51,48,32]
Its knowing when to switch from Plan2 to Plan3 :)Maybe we should just cripple JSONata so it can't do anything more than the basics SonofJSONata :() xkcd.com/927 obligatory reference at his point :)As a current practical issue - should I try to use JSONata to go over this array of values (a sensor update msg from Scratch - 1st 4 bytes are length of msg and can be ignored as whole message comes in at once except for very complex/lots of data) and convert the char values back to a string in JSONata ?
[0,0,0,25,115,101,110,115,111,114,45,117,112,100,97,116,101,32,34,99,111,117,110,116,34,32,51,48,32]
var string = '';
for (x=4; x < msg.payload.length; x++) {
string += String.fromCharCode(msg.payload[x]);
}
msg.payload = string;
node.send(msg);
--
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+u...@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/c212fd13-66e1-4f1d-a8a5-12fc86cd669a%40googlegroups.com.
msg.payload = Buffer.from(msg.payload.slice(4)).toString();
return msg;