I'm new and I'd like to get some help to split a string into separate elements in NodeRed.
As an example,
- my msg.payload is '11110110'
- and I like to get separate data/lines (array) such as 1, 1, 1, 1, 0, 1, 1 and 0
Can I do this with "split" and how?
You can use the split node to get 8 seperate messages
You can then use the join node to get those into an array
Above solution is perfect. Alternatively you could use below piece of code inside a function node.
msg.payload = [...msg.payload];
This way an incoming string will be changed to an array.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.