# Payload as dropdown pair

**URL:** <https://discourse.nodered.org/t/payload-as-dropdown-pair/47784>\
**Category:** General\
**Created:** [29 June 2021 10:11 UTC](https://discourse.nodered.org/t/payload-as-dropdown-pair/47784 "2021-06-29T10:11:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![watwat](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/watwat/32/43131_2.png) [@watwat](https://discourse.nodered.org/u/watwat)\
**Post date:** [29 June 2021 10:11 UTC](https://discourse.nodered.org/t/payload-as-dropdown-pair/47784/1 "2021-06-29T10:11:18Z")

</div>

A problem that I have walked upon is getting a msg.payload as the label in a dropdown, though it works the way around as an id.  
This is what I want (ends up in error):

```auto
{msg.payload: id}

```

but having it as id works fine:

```auto
{label: msg.payload}

```

I might guess there is a workaround for this so I appreciate all answers.

---

<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:** [29 June 2021 11:08 UTC](https://discourse.nodered.org/t/payload-as-dropdown-pair/47784/2 "2021-06-29T11:08:16Z")

</div>

> [@watwat](#):
>
> `{msg.payload: id}`

try  
`{[msg.payload]: id}`

> **[How to Set Dynamic Property Keys with ES6 🎉 | SamanthaMing.com](https://www.samanthaming.com/tidbits/37-dynamic-property-name-with-es6/)**
>
> Previously, we always had to use the bracket notation to use a dynamic key. With ES6, we can finally create dynamic variable key in the object declaration...

---

<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:** [13 July 2021 11:08 UTC](https://discourse.nodered.org/t/payload-as-dropdown-pair/47784/3 "2021-07-13T11:08:28Z")

</div>

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