# Cannot read the TheThingsNetwork data in node-red

**URL:** https://discourse.nodered.org/t/cannot-read-the-thethingsnetwork-data-in-node-red/76493
**Category:** General
**Created:** [13 March 2023 03:57 UTC](https://discourse.nodered.org/t/cannot-read-the-thethingsnetwork-data-in-node-red/76493 "2023-03-13T03:57:32Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![henrychanflag](https://avatars.discourse-cdn.com/v4/letter/h/e9c0ed/32.png) [@henrychanflag](https://discourse.nodered.org/u/henrychanflag)
#### Post date: [13 March 2023 03:57 UTC](https://discourse.nodered.org/t/cannot-read-the-thethingsnetwork-data-in-node-red/76493/1 "2023-03-13T03:57:32Z")

</div>

Hi All,

I’ve successfully connected my Lora node to TTN and now I can receive the node data in node-red. In my arduino code (shared folder), I just send text “{hello}” and try to decode in node-red at the debug node. Attached please find my flow in node-red in my shared folder.  
I have also configure the data formatter in TTN such that data bytes can be seem in node-red.

![uplink_formatter.png](https://sea2.discourse-cdn.com/flex016/images/transparent.png)

I can see the data bytes received from my MQTT nodes. However, I cannot get the data out of the packet using Javascript function. I always receive the error “SyntaxError: Unexpected token o in JSON at position 1”.  
Could anyone can help me to resolve this? Thanks!!  
Here is the link of my shared files:  
[https://polyuit-my.sharepoint.com/:f:/g/personal/yk000chan\_polyu\_edu\_hk/EqQojKDQLolOlhjAQQmyPYsBeKoBQc7zWxiiL-GQrX3B8g?e=o8hdyL](https://polyuit-my.sharepoint.com/:f:/g/personal/yk000chan_polyu_edu_hk/EqQojKDQLolOlhjAQQmyPYsBeKoBQc7zWxiiL-GQrX3B8g?e=o8hdyL)

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [13 March 2023 08:09 UTC](https://discourse.nodered.org/t/cannot-read-the-thethingsnetwork-data-in-node-red/76493/2 "2023-03-13T08:09:35Z")

</div>

Welcome to the forum @henrychanflag

If you want to share some of your flow then you can paste it in here. Make sure you only export the nodes that matter. Here is how to do it:

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote `````)

````auto
``` 
   code goes here 
```

````

See this post for more details - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

In the meantime, show us what is coming out of the mqtt node by sending it to a debug node. If it is the mqtt node that is showing the error then set it to Auto Detect mode.

If you are a beginner with node red I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

Pay particular attention to the section Working with messages.

---

<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: [12 May 2023 08:09 UTC](https://discourse.nodered.org/t/cannot-read-the-thethingsnetwork-data-in-node-red/76493/3 "2023-05-12T08:09:38Z")

</div>

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