I have a "config" file that slowly is growing.
This is it:
{"1":{"number":0},"2":{"number":1},"3":{"number":1},"4":{"number":0},"5":{"number":1},"6":{"number":0},"7":{"number":0},"8":{"number":0},"9":{"number":1},"10":{"number":1},"11":{"number":0},"12":{"number":0},"13":{"number":1},"14":{"number":0},"15":{"number":1},"16":{"number":0},"17":{"number":0},"18":{"number":0}}
Nothing special.
But a slight pain to edit/add.
Is there a way I could make it more like:
{
"1":{"number":0},
"2":{"number":1},
"3":{"number":1},
"4":{"number":0},
"5":{"number":1},
"6":{"number":0},
"7":{"number":0},
"8":{"number":0},
"9":{"number":1},
"10":{"number":1},
"11":{"number":0},
"12":{"number":0},
"13":{"number":1},
"14":{"number":0},
"15":{"number":1},
"16":{"number":0},
"17":{"number":0},
"18":{"number":0}
}
Just then when I add a new line I can do it a bit easier.
And it makes it a bit more human readable if I need to check the status.
Thanks.
Oh, sorry.
This is how I write the file.
[{"id":"d4ffc695.91eec8","type":"change","z":"bdc47459.27c378","g":"98c1a978c6893072","name":"get flow.active","rules":[{"t":"set","p":"payload","pt":"msg","to":"active","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":770,"wires":[["a15038ab.34cab"]]},{"id":"a15038ab.34cab","type":"function","z":"bdc47459.27c378","g":"98c1a978c6893072","name":"Set path/name","func":"var path = \"/home/pi/.node-red/public/\";\nmsg.filename = path + \"active.txt\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":345,"y":810,"wires":[["807cc452.203388"]],"l":false},{"id":"807cc452.203388","type":"file","z":"bdc47459.27c378","g":"98c1a978c6893072","name":"","filename":"","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"none","x":460,"y":810,"wires":[[]]}]
I'm not sure I would need to edit the reading, as I'm guessing the <cr>
are taken out when read.