# Help parsing a json file (Urgent)

**URL:** <https://discourse.nodered.org/t/help-parsing-a-json-file-urgent/44587>\
**Category:** General\
**Created:** [23 April 2021 08:10 UTC](https://discourse.nodered.org/t/help-parsing-a-json-file-urgent/44587 "2021-04-23T08:10:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mchacher](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mchacher/32/40619_2.png) [@mchacher](https://discourse.nodered.org/u/mchacher)\
**Post date:** [23 April 2021 08:10 UTC](https://discourse.nodered.org/t/help-parsing-a-json-file-urgent/44587/1 "2021-04-23T08:10:53Z")

</div>

Hi,  
I am a beginner with node red. I am receiving from The Thing Stack quite a complex JSON string over MQTT. I am only interested in a very small subset of the JSON payload received.  
What is the best way to extract the "decode\_payload", and all its data (I mean "decoded\_payload":{"analog\_in\_0":4.21,"analog\_in\_1":5.22,"digital\_in\_0":1}) in the long JSON below.

Thanks a lot for your help,

I am stuck.

Marc

"{"end\_device\_ids":{"device\_id":"hive-00001","application\_ids":{"application\_id":"hive-app-id"},"dev\_eui":"AA00AA00BB00BBAA","join\_eui":"AAAAAAAAAAAAAAAA","dev\_addr":"260B1E5D"},"correlation\_ids":["as:up:01F3YW7W7CRWHNW5TK1F6AZGE6","gs:conn:01F3Y16MFA0TCEEY8RMAEHSQPY","gs:up:host:01F3Y16MFNJ5G7VB6HN094BBKZ","gs:uplink:01F3YW7W0VPE0YXKJAEA8D38NK","ns:uplink:01F3YW7W0XSY3NX3EKQZBK0EYK","rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01F3YW7W0XJRY37ZGT3X9PJMQJ","rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01F3YW7W7CX3STQB4HHWZPH8Y7"],"received\_at":"2021-04-23T08:06:20.141290010Z","uplink\_message":{"session\_key\_id":"AXj7II2SgHRA1OoyoTuAEg==","f\_port":1,"f\_cnt":1291,"frm\_payload":"AAABAAIBpQECAgo=","decoded\_payload":{"analog\_in\_0":4.21,"analog\_in\_1":5.22,"digital\_in\_0":1},"rx\_metadata":[{"gateway\_ids":{"gateway\_id":"venon-mch-gn"},"time":"2021-04-23T08:06:19Z","timestamp":3454645003,"rssi":-33,"channel\_rssi":-33,"snr":8.75,"uplink\_token":"ChAKDgoMdmVub24tbWNoLWduEIvmpu8MGgwI+/+JhAYQj72kvAMg+MWNx8XSBg=="}],..."

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [23 April 2021 08:17 UTC](https://discourse.nodered.org/t/help-parsing-a-json-file-urgent/44587/2 "2021-04-23T08:17:18Z")

</div>

Hi Marc, as a newbe to node-red i will list out some resources. No more than an hour or so reading / watching & you should be flying...

#### Firstly,

[This post](https://dev.to/desoga/javascript-object-vs-json-demystified-494j) should help to clarify the difference between Javascript objects and JSON.

#### Secondly,

There’s a great page in the docs that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

![BX00Cy7yHi](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bd1f333a9e043b061b39917c328b0094d3e52d30.gif)

> **[Working with messages : Node-RED](https://nodered.org/docs/user-guide/messages)**

#### And last but not least

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.

* * *

Quick version...

A JSON string can be converted to an object where you can use the buttons in the debug window (as demos in the GIF above)

Often (like in the MQTT) node, you can set the MQTT node settings to parse the JSON into an object (meaning you dont need the JSON node).

* * *

Hope that helps.

---

<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:** [23 April 2021 08:29 UTC](https://discourse.nodered.org/t/help-parsing-a-json-file-urgent/44587/3 "2021-04-23T08:29:03Z")

</div>

And one more which describes how, for the future, to post flows or code so that the forum does not mess up the format: [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<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:** [22 June 2021 08:29 UTC](https://discourse.nodered.org/t/help-parsing-a-json-file-urgent/44587/4 "2021-06-22T08:29:55Z")

</div>

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