1var data = { records : [{ "empid": 1, "fname": "X", "lname": "Y" }, { "empid": 2, "fname": "A", "lname": "Y" }, { "empid": 3, "fname": "B", "lname": "Y" }, { "empid": 4, "fname": "C", "lname": "Y" }, { "empid": 5, "fname": "C", "lname": "Y" }] }
2var empIds = [1,4,5]
3var filteredArray = data.records.filter(function(itm){
4 return empIds.indexOf(itm.empid) > -1;
5});
6
7filteredArray = { records : filteredArray };
8