我想返回每个属性的计数。例如,我想返回每个组中有多少人。因此,对于以下 JSON,它将返回第 1 组中的 3 人、第 3 组中的 3 人、第 16 组中的 2 人等。
我正在寻找 Javascript 或 jQuery 解决方案。
注意:我不需要帮助解析 JSON。我只需要帮助来查找每次出现的次数。
{
"people":[
{"id":"0","name":"Mike Johnson","group":1},
{"id":"1","name":"Bob Smith","group":2},
{"id":"2","name":"Richard Thomas","group":3},
{"id":"3","name":"Betty White","group":16},
{"id":"4","name":"Tim Thompson","group":3},
{"id":"5","name":"Carl Lewis","group":16},
{"id":"6","name":"Kathy Towers","group":3},
{"id":"7","name":"Billy Bob","group":1},
{"id":"8","name":"Sally Bailey","group":1}
]
}