So I've been beating my head against the wall and need some help. I have this object:
{
"cameras": {
"cam1": {
"label": "Front Door",
"rotation": "0deg"
},
"cam2": {
"label": "Driveway",
"rotation": "0deg"
},
"cam3": {
"label": "Garden",
"rotation": "0deg"
},
"cam4": {
"label": "Shed",
"rotation": "0deg"
},
"cam5": {
"label": "Backyard",
"rotation": "0deg"
}
}
}
that I want to convert to this object:
{
"cameras": [
{
"name": "cam1",
"label": "Front Door",
"rotation": "0deg"
},
{
"name": "cam2",
"label": "Driveway",
"rotation": "0deg"
},
{
"name": "cam3",
"label": "Garden",
"rotation": "0deg"
},
{
"name": "cam4",
"label": "Shed",
"rotation": "0deg"
},
{
"name": "cam5",
"label": "Backyard",
"rotation": "0deg"
}
]
}
and I can't figure it out. Here is a flow with an inject
node with the objects in it, an empty function
node and a debug
node anyone can play with.
[{"id":"23605468e7d390f7","type":"inject","z":"96bf579fe7b64086","name":"","props":[{"p":"payload"},{"p":"want","v":"{\"cameras\":[{\"name\":\"cam1\",\"label\":\"Front Door\",\"rotation\":\"0deg\"},{\"name\":\"cam2\",\"label\":\"Driveway\",\"rotation\":\"0deg\"},{\"name\":\"cam3\",\"label\":\"Garden\",\"rotation\":\"0deg\"},{\"name\":\"cam4\",\"label\":\"Shed\",\"rotation\":\"0deg\"},{\"name\":\"cam5\",\"label\":\"Backyard\",\"rotation\":\"0deg\"}]}","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"cameras\":{\"cam1\":{\"label\":\"Front Door\",\"rotation\":\"0deg\"},\"cam2\":{\"label\":\"Driveway\",\"rotation\":\"0deg\"},\"cam3\":{\"label\":\"Garden\",\"rotation\":\"0deg\"},\"cam4\":{\"label\":\"Shed\",\"rotation\":\"0deg\"},\"cam5\":{\"label\":\"Backyard\",\"rotation\":\"0deg\"}}}","payloadType":"json","x":270,"y":200,"wires":[["507955f615e523b1"]]},{"id":"e1ea330e059e2fbe","type":"debug","z":"96bf579fe7b64086","name":"debug 33","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":740,"y":200,"wires":[]},{"id":"507955f615e523b1","type":"function","z":"96bf579fe7b64086","name":"function 2","func":"\n// ???????\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":200,"wires":[["e1ea330e059e2fbe"]]}]
Thanks in advance for anyone how can offer a solution!