Convert array to a specified string for a telnet connection

i please need help with a function node.
From a sql query i get an array with a variable number of objects.

Now i need to send this data via a telnet connection to my device as follows:


Can please anybody help me with the function node to realize this?

Thanks in advance



msg.payload = => Object.values(v).join("")).join("|");
return msg;
1 Like

Something like this might get you close:

msg.payload = Object.entries(msg.payload);
let result = "";
for (let i = 0; i < msg.payload.length; i++) {
    result += msg.payload[i][1];
msg.payload = result;
return msg;

Thank to both of you!
This works well for me.
Thank you for your help!