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

<div class="post-metadata">

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

</div>

> [@zenofmud](#):
>
> you could use a JSONata expression

Or in JavaScript:

`msg.payload.filter(function(item){return item.fitting === 'wall'}).length;`  
or  
`msg.payload.filter(function(item){return item.zone === 'bedroom1'}).length; `

Not as neat as @zenofmud's expression but usable in a `function` node that might be doing a bunch of other stuff.

---

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