📜  json 搜索 javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:19.510000             🧑  作者: Mango

代码示例2
var results = [];
var searchField = "name";
var searchVal = "my Name";
for (var i=0 ; i < obj.list.length ; i++)
{
    if (obj.list[i][searchField] == searchVal) {
        results.push(obj.list[i]);
    }
}