# How to save and load flow Context Data

**URL:** <https://discourse.nodered.org/t/how-to-save-and-load-flow-context-data/70657>\
**Category:** General\
**Created:** [15 November 2022 15:43 UTC](https://discourse.nodered.org/t/how-to-save-and-load-flow-context-data/70657 "2022-11-15T15:43:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mbessing](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mbessing/32/59136_2.png) [@Mbessing](https://discourse.nodered.org/u/Mbessing)\
**Post date:** [15 November 2022 15:43 UTC](https://discourse.nodered.org/t/how-to-save-and-load-flow-context-data/70657/1 "2022-11-15T15:43:39Z")

</div>

Hi,

I'm working on a project in which the user configures a dashboard basically by modifying different objects and arrays. When I close and open Node-RED I want these variables to remain the same as when closed. I've been doing some research and to my understand this is currently only possible by exporting a json file before the program is closed and load it once the program again is started. Can anyone confirm this? And if so, possibly provide an example or explain how this can be done in more detail? I would be really appreciated. Thanks in advance!

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [15 November 2022 16:52 UTC](https://discourse.nodered.org/t/how-to-save-and-load-flow-context-data/70657/2 "2022-11-15T16:52:06Z")

</div>

Sounds like you are looking for context. [See documentation](https://nodered.org/docs/user-guide/context).

---

<div class="post-metadata">

**Author:** ![Mbessing](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mbessing/32/59136_2.png) [@Mbessing](https://discourse.nodered.org/u/Mbessing)\
**Post date:** [15 November 2022 22:21 UTC](https://discourse.nodered.org/t/how-to-save-and-load-flow-context-data/70657/3 "2022-11-15T22:21:36Z")

</div>

Thank you. I've tried to paste the following inside the setting.js file:

 ![Skærmbillede 2022-11-15 231856](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/e/6e3d8560a724bd4927bd5a7edb39119349286977.jpeg)

When I close and open Node-RED it does not however look like the context data is loaded:  
 ![Skærmbillede 2022-11-15 232048](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/a/9a8d389734994ad1ef9d8d8740c4e306b2c1e0fd.jpeg)

Do I have to do anything special in order to load the data to Node-RED? I thought they'd be loaded automatically if they were stored.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [16 November 2022 03:52 UTC](https://discourse.nodered.org/t/how-to-save-and-load-flow-context-data/70657/4 "2022-11-16T03:52:19Z")

</div>

> [@Mbessing](#):
>
> Thank you. I've tried to paste the following inside the setting.js file:

The documentation contains a lot of words explaining context. Read what you have pasted.  
Note that all the settings were already in the settings file, you just needed to uncomment it, but i digress.

---

<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:** [16 November 2022 09:03 UTC](https://discourse.nodered.org/t/how-to-save-and-load-flow-context-data/70657/5 "2022-11-16T09:03:15Z")

</div>

> [@Mbessing](#):
>
> When I close and open Node-RED i

You have to restart node-red, not just close and open the browser window.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [16 November 2022 10:46 UTC](https://discourse.nodered.org/t/how-to-save-and-load-flow-context-data/70657/6 "2022-11-16T10:46:22Z")

</div>

I wrote this (quite) awhile ago but it might help you understand a bit more about context data:

> [@A guide to understanding 'Persistent Context'](https://discourse.nodered.org/t/a-guide-to-understanding-persistent-context/4115):
>
> This is something I wrote up after playing with the context options. I've filed a PR with some of this added to the Node-RED documentation but thought I'd release it here also. I hope people find it useful. Paul A guide to understanding 'Persistent Context' Prior to Node-RED v0.19.0, data could be stored in context as a global, flow or node. This was stored in memory and would be reset with a restart of Node-RED. As of v.0.19.0 you can now store node, flow and global context data in memory O…

---

<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 January 2023 10:47 UTC](https://discourse.nodered.org/t/how-to-save-and-load-flow-context-data/70657/7 "2023-01-15T10:47:04Z")

</div>

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