I have an API that returns an object array like the example below. How can I access the nested array of objects within the JSON data to find the role with roleid = 2 when EmpId is 102 using TypeScript?
0- {
EmpId: 101,
EmpName:'abc'
Role :
0- {roleid :1,
role:Admin,
isdeletee:true},
1- {roleid :2,
role:user,
isdeletee:true},
2- {roleid :3, role :Admin,
isdeletee:true}
}
1- {
EmpId: 102,
EmpName:'xyz'
Role :
0- {roleid :1,
role:Admin,
isdeletee:true},
1- {roleid :2,
role:user,
isdeletee:true},
2- {roleid :3, role :Admin,
isdeletee:true}
}
2- {
EmpId: 103,
EmpName:'xez'
Role :
0- {roleid :21,
role:userx,
isdeletee:true},
1- {roleid :2,
role:user,
isdeletee:true},
2- {roleid :31, role :ad,
isdeletee:true}
},