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

**URL:** https://discourse.nodered.org/t/sending-message-through-tcp-udp-turns-them-to-object-object-how-do-i-fix-them/70299
**Category:** General
**Created:** [9 November 2022 06:23 UTC](https://discourse.nodered.org/t/sending-message-through-tcp-udp-turns-them-to-object-object-how-do-i-fix-them/70299 "2022-11-09T06:23:20Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![krr813](https://avatars.discourse-cdn.com/v4/letter/k/ea666f/32.png) [@krr813](https://discourse.nodered.org/u/krr813)
#### Post date: [9 November 2022 06:23 UTC](https://discourse.nodered.org/t/sending-message-through-tcp-udp-turns-them-to-object-object-how-do-i-fix-them/70299/1 "2022-11-09T06:23:20Z")

</div>

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?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/4/d42df1491bd74b295579a23fee6c98ca4e11f9ee.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/6/6698617fce163074ed9cc6773f07485d7c3a0d41.png)

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [9 November 2022 08:27 UTC](https://discourse.nodered.org/t/sending-message-through-tcp-udp-turns-them-to-object-object-how-do-i-fix-them/70299/2 "2022-11-09T08:27:41Z")

</div>

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

---

<div class="post-metadata">

### Author: ![krr813](https://avatars.discourse-cdn.com/v4/letter/k/ea666f/32.png) [@krr813](https://discourse.nodered.org/u/krr813)
#### Post date: [9 November 2022 08:34 UTC](https://discourse.nodered.org/t/sending-message-through-tcp-udp-turns-them-to-object-object-how-do-i-fix-them/70299/3 "2022-11-09T08:34:36Z")

</div>

Thank you for your response.

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

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [9 November 2022 08:39 UTC](https://discourse.nodered.org/t/sending-message-through-tcp-udp-turns-them-to-object-object-how-do-i-fix-them/70299/4 "2022-11-09T08:39:02Z")

</div>

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.

```auto
[{"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":[]}]

```

---

<div class="post-metadata">

### Author: ![krr813](https://avatars.discourse-cdn.com/v4/letter/k/ea666f/32.png) [@krr813](https://discourse.nodered.org/u/krr813)
#### Post date: [10 November 2022 00:27 UTC](https://discourse.nodered.org/t/sending-message-through-tcp-udp-turns-them-to-object-object-how-do-i-fix-them/70299/5 "2022-11-10T00:27:38Z")

</div>

Thank you.  
This solved my problem.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [24 November 2022 00:28 UTC](https://discourse.nodered.org/t/sending-message-through-tcp-udp-turns-them-to-object-object-how-do-i-fix-them/70299/6 "2022-11-24T00:28:23Z")

</div>

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