# How do i continuosly update the payload?

**URL:** <https://discourse.nodered.org/t/how-do-i-continuosly-update-the-payload/64580>\
**Category:** General\
**Created:** [1 July 2022 08:37 UTC](https://discourse.nodered.org/t/how-do-i-continuosly-update-the-payload/64580 "2022-07-01T08:37:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Huntonion](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/huntonion/32/64080_2.png) [@Huntonion](https://discourse.nodered.org/u/Huntonion)\
**Post date:** [1 July 2022 08:37 UTC](https://discourse.nodered.org/t/how-do-i-continuosly-update-the-payload/64580/1 "2022-07-01T08:37:25Z")

</div>

Hello, I have an inject node that injects every x seconds a Json string,and I have a function node which operates on the json string, and i want to save those changes in order to have the updated json string every time it injects. How can I do that?

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [1 July 2022 10:10 UTC](https://discourse.nodered.org/t/how-do-i-continuosly-update-the-payload/64580/2 "2022-07-01T10:10:58Z")

</div>

Welcome to the forum!

Store the JSON in a Global varable.  
[https://nodered.org/docs/user-guide/context](https://nodered.org/docs/user-guide/context)

---

<div class="post-metadata">

**Author:** ![Huntonion](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/huntonion/32/64080_2.png) [@Huntonion](https://discourse.nodered.org/u/Huntonion)\
**Post date:** [1 July 2022 10:38 UTC](https://discourse.nodered.org/t/how-do-i-continuosly-update-the-payload/64580/3 "2022-07-01T10:38:44Z")

</div>

Thank you, I actually did try using a flow/global variable but I was doing something wrong.  
Instead of writing

> msg.payload = flow.get("payload");

I was writing

> msg.payload = flow.payload;

So now it works.

---

<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 2022 10:39 UTC](https://discourse.nodered.org/t/how-do-i-continuosly-update-the-payload/64580/4 "2022-07-15T10:39:40Z")

</div>

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