# How to store data in JSON file in Node-RED

**URL:** https://discourse.nodered.org/t/how-to-store-data-in-json-file-in-node-red/6480
**Category:** General
**Created:** [6 January 2019 23:56 UTC](https://discourse.nodered.org/t/how-to-store-data-in-json-file-in-node-red/6480 "2019-01-06T23:56:57Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![hazymat](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hazymat/32/108159_2.png) [@hazymat](https://discourse.nodered.org/u/hazymat)
#### Post date: [6 January 2019 23:56 UTC](https://discourse.nodered.org/t/how-to-store-data-in-json-file-in-node-red/6480/1 "2019-01-06T23:56:57Z")

</div>

Hi, this is quite a "beginner's" question but hopefully someone can help?

I want to build up a "definitions" file that describes the properties for various custom DIY home automation devices.

I'm thinking the best way might be some form of JSON file on disk.

Should I use context, and store to disk?

I have already turned on disk storage in settings.js by adding the following:

```auto
        default: {
            module:"localfilesystem"
        },
    },

```

So for example:

Light 1 (zone = bedroom1, name="Wall Light", fitting=wall, colour=warmwhite, currentlevel=50%)  
Light 2 (zone = bedroom1, name="Ceiling Light", fitting=ceiling, colour=RGB, currentlevel=(40,50,0))  
PIR 1 (zone = bedroom1, fitting=ceiling, state=idle, etc....)  
BedroomScene0 (Light1=0%, Light2=0%, Light3=0%, Light4=0%)  
BedroomScene1 (Light1=50%, Light2=25%, Light3=0%, Light4=100%)  
BedroomScene2 (Light1=100%, Light2=100%, Light3=100%, Light4=100%)  
etc...

The reason I think I'd like to do this, is so that in the future I might:

- dynamically generate dashboard buttons, sliders, etc.
- count the number of light circuits in a room (in case I add or remove some later)
- be able to set up / store light scene definitions, e.g. from the dashboard
- persist light levels across reboots
- more?

Does this seem like a good thing to do?

Any tips on how to manage this well, e.g. how to populate the settings initially, such as when I add a new light etc?

Sorry it's a general question, but I'm overwhelmed by the possibilities so far.

---

_[View the full topic](https://discourse.nodered.org/t/how-to-store-data-in-json-file-in-node-red/6480)._
