我有一个JSON数组,格式如下,我需要获取属于同一个国家的对象,即" country" key或" country_short"我的JSP中的关键。有人可以帮忙吗?
[{
"country_short": "USA",
"city": "Butler",
"description": "",
"date_new": "2016-09-27 21:26:23",
"url": "--",
"country": "United States",
"company": "Cargill",
"title": "Yard Driver",
"reqid": "BUT00451",
"state": "Wisconsin",
"state_short": "WI",
"location": "Butler, WI",
"guid": "04F2182583FC429BBAEF8B86F8467A55",
"uid": null
}, {
"country_short": "CAN",
"city": "Camrose",
"description": "",
"date_new": "2016-09-27 21:26:23",
"url": "--",
"country": "Canada",
"company": "Cargill",
"title": "Agronomy Associate",
"reqid": "CAN00437",
"state": "Alberta",
"state_short": "AB",
"location": "Camrose, AB",
"guid": "9FB7383A512F48F893C535765F9FBE4F",
"uid": null
}]
提前致谢!
答案 0 :(得分:0)
您可以像这样使用JS过滤器方法
a.filter(function(item){return item.country_short.toLowerCase()=='usa'});