JS 部份
var myArray = [{'id':'1', 'name':'tom'}, {'id':'2', 'name':'kevin'}];
//find out the name by id
var id_is_1 = myArray.find(x => x.id === '1').name; //output tom
//find out index
var index = myArray.findIndex(x => x.id === '1'); //output 0
參考資料
https://stackoverflow.com/questions/7364150/find-object-by-id-in-an-array-of-javascript-objects