How to store data in JSON file in Node-RED

Sorry, I was in a hurry with that original response. I was actually thinking about other possible ways to restructure the data so that you didn't need to process it as much - such as splitting the top-level by type so that all the lights were on one property. Then, once again, you could use Object.keys().length and stick with named properties if you wanted to. But of course, once you get into needing to filter an array or object by a sub-property, you might as well stick with an array so that you can use the filter function.

1 Like