I have constructed objects as follow:
Object 1
[ {
ext: '1287',
ip: '(Unspecified)',
queue: [ ]
} ]
Object 2
[ { Queue: '222',
Members:
[ {"ext":"1287"},
{"ext":"4118"} ],
Callers: [] },
{ Queue: '111',
Members:
[ {"ext":"4131"},
{"ext":"1287"},
{"ext":"4138"}
],
Callers: [] }]
I want to compare Object 1 and Object 2. If the value of ext key from Object 1 exists in the nested Members object of Object 2 then the value of Queue should be pushed to a queue array and the final object should be like as shown below.
Final Object that I want
[{ ext: '1287',
ip: '(Unspecified)',
queue: [222, 111 ] }]
I need some hints regarding how a nested object like this is compared using lodash.
'{"ext":"4131"}'is a string in the question. Is it a typo?