# Getting value out of message

**URL:** <https://discourse.nodered.org/t/getting-value-out-of-message/79523>\
**Category:** General\
**Created:** [1 July 2023 12:05 UTC](https://discourse.nodered.org/t/getting-value-out-of-message/79523 "2023-07-01T12:05:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![warnert](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/warnert/32/108132_2.png) [@warnert](https://discourse.nodered.org/u/warnert)\
**Post date:** [1 July 2023 12:05 UTC](https://discourse.nodered.org/t/getting-value-out-of-message/79523/1 "2023-07-01T12:05:52Z")

</div>

I try to get the value for nextEvent from eztimer where I used sunsetStart as triggermoment.  
I get back:

```auto
1-7-2023 11:54:44node: debug 7
info : msg.payload : Object
object
name: "eztimer"
state: undefined
trigger: object
property: "msg.payload"
value: 1
nextEvent: "2023-07-01T19:55:57.515Z"

```

but when I do in a functionnode

```auto
var when = msg.payload.nextEvent;

```

I get an "undefined" back.  
I think I do not understand how to get this value from te message.

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [1 July 2023 12:21 UTC](https://discourse.nodered.org/t/getting-value-out-of-message/79523/2 "2023-07-01T12:21:48Z")

</div>

You could try the following and see if that works for you.  
`let when = msg.payload['nextEvent'];`

Like @E1cid said, I suspect the structure for the complete object is a bit different to what you posted.  
`let when = msg.payload.trigger['nextEvent'];`

---

<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:** [1 July 2023 12:23 UTC](https://discourse.nodered.org/t/getting-value-out-of-message/79523/3 "2023-07-01T12:23:04Z")

</div>

If you use the copy path button described [here](https://nodered.org/docs/user-guide/messages#understanding-the-structure-of-a-message) you will get the correct path to use.  
I suspect it is `msg.payload.trigger.nextEvent`, but your posted info is not great, you can use the copy value button to get a correctly formatted json to post in future.

---

<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:** [15 July 2023 12:23 UTC](https://discourse.nodered.org/t/getting-value-out-of-message/79523/4 "2023-07-15T12:23:36Z")

</div>

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