OK, done. Sorry it took so long, had to go deal with the washing
Here is the JSONata we need:
payload.nodes {
"TOTAL": $count($keys($)),
"node_modules": $keys($)
}
And here is an example flow. Note the example has two file read's to illustrate Linux and Windows file paths. You will need to adjust the file paths to suit your own installation.
[{"id":"57f9f3a.e32620c","type":"file in","z":"d480ffdb.73b02","name":"","filename":"/home/pi//node/nrlive/.data/.config.json","format":"utf8","chunk":false,"sendError":false,"x":470,"y":1040,"wires":[["d1d4a711.9a25d8"]]},{"id":"d1d4a711.9a25d8","type":"json","z":"d480ffdb.73b02","name":"","pretty":false,"x":690,"y":1040,"wires":[["e1bdf411.316238"]]},{"id":"e1bdf411.316238","type":"change","z":"d480ffdb.73b02","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.nodes {\t \"TOTAL\": $count($keys($)),\t \"node_modules\": $keys($)\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1040,"wires":[["1a0235f0.8c486a"]]},{"id":"1a0235f0.8c486a","type":"debug","z":"d480ffdb.73b02","name":"","active":true,"console":"false","complete":"false","x":1050,"y":1040,"wires":[]},{"id":"b6c696f6.b0bbe8","type":"inject","z":"d480ffdb.73b02","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":240,"y":1040,"wires":[["57f9f3a.e32620c","62b31849.ce3328"]]},{"id":"bae74244.be8fa","type":"comment","z":"d480ffdb.73b02","name":"How Many Node modules in my configuration?","info":"","x":350,"y":1000,"wires":[]},{"id":"62b31849.ce3328","type":"file in","z":"d480ffdb.73b02","name":"","filename":"C:\\src\\nr\\data\\.config.json","format":"utf8","chunk":false,"sendError":false,"x":430,"y":1080,"wires":[["d1d4a711.9a25d8"]]}]
Trivial in the end.