2016-09-30 53 views
0

我有一个JSON数组,具有以下格式,我需要获取属于同一国家的对象,即“国家”键或“country_short”具有相同值关键在我的JSP。任何人都可以帮忙吗?需要帮助从JSON数组中提取特定的对象

[{ 
    "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

可以使用这样

a.filter JS的过滤方法(函数(项目){返回item.country_short.toLowerCase()== 'USA'});

+0

谢谢..但我不应该使用JS。我能够使用简单的JSON来完成它 –