# Javascript Object.keys() help

**URL:** https://discourse.nodered.org/t/javascript-object-keys-help/99934
**Category:** General
**Created:** [12 December 2025 10:14 UTC](https://discourse.nodered.org/t/javascript-object-keys-help/99934 "2025-12-12T10:14:11Z")
**Posts on this page:** 5
**Page:** 1

<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: [12 December 2025 10:14 UTC](https://discourse.nodered.org/t/javascript-object-keys-help/99934/1 "2025-12-12T10:14:11Z")

</div>

I must be missing something obvious, can someone explain, please, how this code

```auto
const hasExtraProps = message => {
  const allowed = ['_msgid', 'ui_update', 'class', 'visible', 'enabled']
  console.log(`message: ${JSON.stringify(message)}`)
  const keys = Object.keys(message)
  console.log(`keys: ${JSON.stringify(keys)}`)
  
  return keys.length > 0 && keys.some(key => !allowed.includes(key))
}

```

can show this in the log?

```auto
message: {"ui_update":{"color":"#E67E22"},"_msgid":"f047d5bf7047ad56"}
keys: ["ui_update","_msgid","payload"]

```

Where is the key "payload" coming from?

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [12 December 2025 11:04 UTC](https://discourse.nodered.org/t/javascript-object-keys-help/99934/2 "2025-12-12T11:04:01Z")

</div>

You would need to share the line that calls the function.

My initial guess would be that the input message has a `payload` property but that its value is `undefined`?

---

<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: [12 December 2025 11:12 UTC](https://discourse.nodered.org/t/javascript-object-keys-help/99934/3 "2025-12-12T11:12:29Z")

</div>

> [@TotallyInformation](#):
>
> My initial guess would be that the input message has a `payload` property but that its value is `undefined`?

Agreed - that suggests `payload` has a value that isn't JSON encodable; could be `undefined`, could be some other object type that doesn't serialize.

---

<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: [12 December 2025 11:41 UTC](https://discourse.nodered.org/t/javascript-object-keys-help/99934/4 "2025-12-12T11:41:56Z")

</div>

Yes, you are exactly right, it is undefined. I had expected JSON.stringify() to show it with value undefined, but apparently not.

Thanks both.

---

<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: [26 December 2025 11:42 UTC](https://discourse.nodered.org/t/javascript-object-keys-help/99934/5 "2025-12-26T11:42:17Z")

</div>

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