chameleonbr / node-red-contrib-redis

Node RED client for Redis with pub/sub, list, lua scripting and other commands support.
MIT License
46 stars 40 forks source link

How can I get an specific field from json value? #17

Closed rcpehls closed 5 years ago

rcpehls commented 5 years ago

Here is my example

[{"id":"87c48812.a21208","type":"debug","z":"1ac24ee5.8fa831","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":727,"y":261,"wires":[]},{"id":"da2c9ce7.b9a13","type":"redis-command","z":"1ac24ee5.8fa831","server":"3d7fbc68.502864","command":"get","name":"","topic":"","x":411,"y":324,"wires":[["19ff7dd.d714182"]]},{"id":"b7b067b5.5a4908","type":"inject","z":"1ac24ee5.8fa831","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":131,"y":324,"wires":[["cb0dd99a.8cff38"]]},{"id":"cb0dd99a.8cff38","type":"function","z":"1ac24ee5.8fa831","name":"","func":"msg.payload = ['test.foo'];\nreturn msg;","outputs":1,"noerr":0,"x":271,"y":324,"wires":[["da2c9ce7.b9a13"]]},{"id":"19ff7dd.d714182","type":"json","z":"1ac24ee5.8fa831","name":"","property":"payload","action":"","pretty":false,"x":561,"y":324,"wires":[["87c48812.a21208"]]},{"id":"6c21ab4a.435564","type":"redis-command","z":"1ac24ee5.8fa831","server":"3d7fbc68.502864","command":"set","name":"","topic":"","x":411,"y":261,"wires":[["87c48812.a21208"]]},{"id":"4047e30f.92ffdc","type":"inject","z":"1ac24ee5.8fa831","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":132,"y":261,"wires":[["3607852b.ef2ffa"]]},{"id":"3607852b.ef2ffa","type":"function","z":"1ac24ee5.8fa831","name":"","func":"msg.payload = ['test','{\"foo\":\"bar\",\"bla\":69}']\nreturn msg;","outputs":1,"noerr":0,"x":271,"y":261,"wires":[["6c21ab4a.435564"]]},{"id":"3d7fbc68.502864","type":"redis-config","z":"","host":"localhost","port":"6379","dbase":"0","pass":""}]

Potter68 commented 5 years ago

it's not a json

chameleonbr commented 5 years ago
[{"id":"8c635231.ddda2","type":"debug","z":"c1e18c68.8a446","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":810,"y":120,"wires":[]},{"id":"38504a8f.d580e6","type":"redis-command","z":"c1e18c68.8a446","server":"f3b5cfed.a07cc","command":"get","name":"","topic":"","params":"{}","paramsType":"json","x":494,"y":183,"wires":[["8b5dce10.532f8"]]},{"id":"60d657aa.6953a8","type":"inject","z":"c1e18c68.8a446","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":214,"y":183,"wires":[["ec649969.d8eb88"]]},{"id":"ec649969.d8eb88","type":"function","z":"c1e18c68.8a446","name":"","func":"msg.payload = ['test'];\nreturn msg;","outputs":1,"noerr":0,"x":354,"y":183,"wires":[["38504a8f.d580e6"]]},{"id":"b8f205bf.ddd0b8","type":"redis-command","z":"c1e18c68.8a446","server":"f3b5cfed.a07cc","command":"set","name":"","topic":"","params":"{}","paramsType":"json","x":560,"y":120,"wires":[["8c635231.ddda2"]]},{"id":"9a176753.d752c8","type":"inject","z":"c1e18c68.8a446","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":215,"y":120,"wires":[["ca22f1ab.93ac1"]]},{"id":"ca22f1ab.93ac1","type":"function","z":"c1e18c68.8a446","name":"","func":"msg.payload = ['test','{\"foo\":\"bar\",\"bla\":69}']\nreturn msg;","outputs":1,"noerr":0,"x":354,"y":120,"wires":[["b8f205bf.ddd0b8"]]},{"id":"8b5dce10.532f8","type":"json","z":"c1e18c68.8a446","name":"","property":"payload","action":"","pretty":false,"x":644,"y":183,"wires":[["8c635231.ddda2"]]},{"id":"f3b5cfed.a07cc","type":"redis-config","z":"","name":"Test","options":"{\"host\":\"localhost\",\"port\":6379}","cluster":false,"optionsType":"json"}]