# 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:** 20

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [11 January 2019 18:21 UTC](https://discourse.nodered.org/t/how-to-store-data-in-json-file-in-node-red/6480/20 "2019-01-11T18:21:16Z")

</div>

> [@hazymat](#):
>
> Is this a vaguely sensible idea?

I think I might put the light/device definitions in an array to make it easier to process. You might also want to think whether you might need a scene to cover more than a single zone - I would certainly want that.

But it all hinges on how you want to actually use the data. As mentioned elsewhere in the thread, it may be a lot more useful to have the array as an array-like object, particularly if you expect it to mainly be used by scene.

```auto
{
    "Getting Dressed": [
        {
            "lightingzone": "3F_Bedroom",
            "devices": [
                {
                    "name": "ceiling",
                    "value": "255",
                },
                {
                    "name": "floor",
                    "value": "255,255,255,255",
                },
                ...
            ],
            ...
        },
        ...
    ],
    ...
}

```

So you might want to map some of that out before committing to a schema.

> [@hazymat](#):
>
> creating my own node type to handle this stuff?

To be worth putting into a node, you'd need to be sure that it would be easily usable by other people who are likely to have very different sets of data.

---

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