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

<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:** [9 January 2019 10:33 UTC](https://discourse.nodered.org/t/how-to-store-data-in-json-file-in-node-red/6480/9 "2019-01-09T10:33:34Z")

</div>

if the data was stored as an array of objects like:

```auto
{
    "payload": [{
        
            "device": "Light 1",
            "zone": "bedroom1",
            "name": "Wall Light",
            "fitting": "wall",
            "colour": "warmwhite"
        },
         {
            "device": "Light 2",
            "zone": "bedroom1",
            "name": "Ceiling Light",
            "fitting": "ceiling",
            "colour": "RGB"
        }]
}

```

then you could use a JSONata expression like: `$count(payload[fitting="wall"])` which would give the result of 1 while this `$count(payload[zone ="bedroom1"])` would give you 2

---

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