let data = [{ a:1, modules:[ {b:2} ] }, { a:3, modules:[ {b:4} ] }, ] let ids = [{target:{a:1},source:"modules"},{target:{b:2},source:null}] function reduceFind( data,ids,index=0){ let key = Object.keys(ids[index].target) let obj = data.find(v=> v[key] ===ids[index].target[key]) if(!obj) return null if(!ids[index].source) return obj; obj = obj[ids[index].source] index++ return reduceFind(obj,ids,index) } console.log(reduceFind(data,ids))