# Change the value of payload in a function node

**URL:** <https://discourse.nodered.org/t/change-the-value-of-payload-in-a-function-node/55662>\
**Category:** General\
**Created:** [24 December 2021 20:12 UTC](https://discourse.nodered.org/t/change-the-value-of-payload-in-a-function-node/55662 "2021-12-24T20:12:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![RichardU](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/richardu/32/19854_2.png) [@RichardU](https://discourse.nodered.org/u/RichardU)\
**Post date:** [24 December 2021 20:12 UTC](https://discourse.nodered.org/t/change-the-value-of-payload-in-a-function-node/55662/1 "2021-12-24T20:12:49Z")

</div>

For various reasons, I'm using a function node to change the payload. My incoming payload is a string. How do I incorporate that into the following function?

```auto
msg.payload = 
{
    data: 
    {
        "message":" incoming_payload ",
        "data":
            {
            "priority":"high",
            "importance":"high",
            }
    }
}

return msg;

```

---

<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:** [24 December 2021 20:17 UTC](https://discourse.nodered.org/t/change-the-value-of-payload-in-a-function-node/55662/2 "2021-12-24T20:17:36Z")

</div>

```auto
msg.payload = 
{
    data: 
    {
        "message": msg.payload,
        "data":
            {
            "priority":"high",
            "importance":"high",
            }
    }
}

return msg;

```

Assuming the incoming payload is `msg.payload`

---

<div class="post-metadata">

**Author:** ![RichardU](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/richardu/32/19854_2.png) [@RichardU](https://discourse.nodered.org/u/RichardU)\
**Post date:** [24 December 2021 22:07 UTC](https://discourse.nodered.org/t/change-the-value-of-payload-in-a-function-node/55662/3 "2021-12-24T22:07:57Z")

</div>

Thanks. I really tried to find the answer before asking, but that looks so obvious it's embarrassing.

Cheers, Richard

---

<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:** [7 January 2022 22:08 UTC](https://discourse.nodered.org/t/change-the-value-of-payload-in-a-function-node/55662/4 "2022-01-07T22:08:38Z")

</div>

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