Cannot read the TheThingsNetwork data in node-red

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

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

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 ```)

``` 
   code goes here 
```

See this post for more details - How to share code or flow json

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. 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.

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