# Access a value on message

**URL:** <https://discourse.nodered.org/t/access-a-value-on-message/10925>\
**Category:** General\
**Created:** [8 May 2019 18:02 UTC](https://discourse.nodered.org/t/access-a-value-on-message/10925 "2019-05-08T18:02:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidcgu](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@davidcgu](https://discourse.nodered.org/u/davidcgu)\
**Post date:** [8 May 2019 18:02 UTC](https://discourse.nodered.org/t/access-a-value-on-message/10925/1 "2019-05-08T18:02:46Z")

</div>

Good afternoon

If is not a bit f abuse can someone help me to access prinTime (as example) on message below in order to get it as mesg.payload?

```auto
{"_timestamp": 1557336569, "progress": 43, "printer_data": {"progress": {"completion": 43.0026015784234, "printTimeLeftOrigin": "genius", "printTime": 6544, "printTimeLeft": 8911, "filepos": 5236192}, "state": {"text": "Printing", "flags": {"cancelling": false, "paused": false, "operational": true, "pausing": false, "printing": true, "resuming": false, "sdReady": false, "error": false, "ready": false, "finishing": false, "closedOrError": false}}, "currentZ": 4.1, "job": {"averagePrintTime": 15455.695065021515, "lastPrintTime": 15455.695065021515, "user": "david", "file": {"origin": "local", "name": "Husky_logo_60--PLAx4.gcode", "date": 1557276735, "path": "Husky_logo_60--PLAx4.gcode", "display": "Husky logo 60%-PLAx4.gcode", "size": 12176454}, "estimatedPrintTime": 13151.32884912111, "filament": {"tool0": {"volume": 12.156581574058073, "length": 5054.119170014139}}}, "offsets": {}}, "location": "local", "path": "Husky_logo_60--PLAx4.gcode"}

```

Thanks in advance

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [8 May 2019 21:40 UTC](https://discourse.nodered.org/t/access-a-value-on-message/10925/2 "2019-05-08T21:40:03Z")

</div>

Hi @davidcgu

This page the docs explains how to understand the structure of a message and identify the path to any element: [https://nodered.org/docs/user-guide/messages](https://nodered.org/docs/user-guide/messages)

---

<div class="post-metadata">

**Author:** ![davidcgu](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@davidcgu](https://discourse.nodered.org/u/davidcgu)\
**Post date:** [13 May 2019 10:49 UTC](https://discourse.nodered.org/t/access-a-value-on-message/10925/3 "2019-05-13T10:49:51Z")

</div>

The more I try the most lost I am, is an object inside another object inside another object and this is making me a bit crazy in order to understand how to access there.

Sorry

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [13 May 2019 12:06 UTC](https://discourse.nodered.org/t/access-a-value-on-message/10925/4 "2019-05-13T12:06:08Z")

</div>

If you pass the message to a Debug node, you can explore its structure to find the element you are interested in:

 ![Local_Node-RED](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/e7c85b723e13416204046b45c53164f9eb3e16b1.png)

When you hover over the element you care about, you'll see a pair buttons appear on the right.

 ![Local_Node-RED](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/5f9067b9e1007b2e30b864736019e8a721644234.png)

Clicking on the first button will copy the path to the item to your clipboard. In this instance it gives:

```auto
payload.printer_data.progress.printTime

```

Which you can then use directly in a Change node, or add `msg.` to the beginning if you want to use it in a Function node.

---

<div class="post-metadata">

**Author:** ![davidcgu](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@davidcgu](https://discourse.nodered.org/u/davidcgu)\
**Post date:** [13 May 2019 12:38 UTC](https://discourse.nodered.org/t/access-a-value-on-message/10925/5 "2019-05-13T12:38:05Z")

</div>

Thanks Nick for your help,

In fact this is what make it so difficult for me to understand because on debug message shows me all in a row instead of giving me separated paths.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/a/a275a02f9baaeef06e9eea3f8b0c4ce6e7658009.png)

Regards

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [13 May 2019 13:05 UTC](https://discourse.nodered.org/t/access-a-value-on-message/10925/6 "2019-05-13T13:05:58Z")

</div>

Hi David,

the page in the docs I linked to says this: [Working with messages : Node-RED](https://nodered.org/docs/user-guide/messages#working-with-json)

> If a message property contains a JSON string it must first be parsed to its equivalent JavaScript object before the properties it contains can be accessed. To determine whether a property contains a String or Object, the Debug node can be used.

> Node-RED provides a `JSON` node to do this conversion.

---

<div class="post-metadata">

**Author:** ![davidcgu](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@davidcgu](https://discourse.nodered.org/u/davidcgu)\
**Post date:** [13 May 2019 13:22 UTC](https://discourse.nodered.org/t/access-a-value-on-message/10925/7 "2019-05-13T13:22:58Z")

</div>

I must be an idiot..... had the json conversion for the node but was looking at the debug prior to that what was making me totally confused, now solved, thanks a lot Nick!
