Sending message through TCP/UDP turns them to [object Object]. How do I fix them?

Hello, I am trying to send msg.payload objects through TCP/UDP, but it seems it doesn't send msg.payload.XXXX properly. Is there a setting I am missing, or am I not supposed to send msg.payload.XXXX objects through TCP/UDP nodes.
If I am not supposed to what is a good way of sending list of messages though TCP/UDP nodes?


Try adding a json node after the udp-in node and see what you get

1 Like

Thank you for your response.

Adding json node gave me this following error message.
"Unexpected token o in JSON at position 1"

You need to convert the object to a JSON string prior to the udp out node, so the json node needs to be there as well.
e.g.

[{"id":"550f90e56d2a20f8","type":"inject","z":"452103ea51141731","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"TEST","payload":"","payloadType":"date","x":100,"y":3220,"wires":[["4a1e21f38e83239f"]]},{"id":"4a1e21f38e83239f","type":"template","z":"452103ea51141731","name":"simulate exec node output","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"1,2,3,4,5\n6,7,8,9,0","output":"str","x":240,"y":3260,"wires":[["2d397990f400c8ac"]]},{"id":"2d397990f400c8ac","type":"csv","z":"452103ea51141731","name":"","sep":",","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":430,"y":3260,"wires":[["43034e381b8d9da8"]]},{"id":"43034e381b8d9da8","type":"json","z":"452103ea51141731","name":"","property":"payload","action":"","pretty":false,"x":510,"y":3300,"wires":[["17bb72744bbfe9ff"]]},{"id":"17bb72744bbfe9ff","type":"udp out","z":"452103ea51141731","name":"","addr":"192.168.1.10","iface":"","port":"5000","ipv":"udp4","outport":"","base64":false,"multicast":"false","x":710,"y":3300,"wires":[]},{"id":"ebb88520defda7a9","type":"udp in","z":"452103ea51141731","name":"","iface":"","port":"5000","ipv":"udp4","multicast":"false","group":"","datatype":"utf8","x":200,"y":3360,"wires":[["025048f25da71652"]]},{"id":"025048f25da71652","type":"json","z":"452103ea51141731","name":"","property":"payload","action":"","pretty":false,"x":370,"y":3360,"wires":[["ed53c09572a948dc"]]},{"id":"ed53c09572a948dc","type":"debug","z":"452103ea51141731","name":"debug 106","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":550,"y":3360,"wires":[]}]
1 Like

Thank you.
This solved my problem.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.