如果我有一个包含多个 JSON 的网站,"usrId":我如何计算它存在多少次?我不知道是计算 JSON 对象更好,还是只计算网页上该词存在多少次,我也不知道如何开始,我该怎么做?
request(getusr, function(err, res, body) {
let json = JSON.parse(body);
let usramount = // count how many times usrId appears
})
示例 json:
{
"id":"example",
"usrId":"example"
},
{
"id":"example"
"usrId":"example",
},