Naren Naren - 1 year ago 119
jQuery Question

check value exists in JSON

my JSON output is coming this way from API

var CityDistrictInfo = [{"classDesc":"FLOOD ZONE 11","classCode":"ZZ","legend":"011","districtName":"Fremont","atrSpaCityDistrictId":"a20cfe2b-51ed-4a11-8384-7fee393378ea","id":"00D18EECC47E7DF44200011302"},{"classDesc":"FLOOD ZONE 7 BONDS","classCode":"QE","legend":"007","districtName":"San Jose","atrSpaCityDistrictId":"a20cfe2b-51ed-4a11-8384-7fee393378ea","id":"00D18EECC47D86EA0E00011202"}]

Can any one please let me know how to validate the "districtName" in jQuery?. If I enter "Fremont" should return true or false.

Thank you in advance.

Answer Source

legendIDs accepts an array of strings. So you should be specifying

var legendIds = ['00D18EECC4A1B4DBC000011202', '00D18EECC4A1CCB9B400011202']
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download