Parsing of json array with jquery -


i have json array

var a_values = new array(); a_values["af:all"] = new array('kbl:kabul','us:new york'); a_values["al:all"] = new array('tia:tirana'); 

how can find , whether given string in a_values, using jquery

for example, need check whether 'kabul' there , in a_values

i think you'd little better:

var abbreviations = new array(); abbreviations['af'] = new array(); abbreviations['af']['kbl'] = 'kabul'; abbreviations['af']['us'] = 'new york'; abbreviations['al'] = new array(); abbreviations['al']['tia'] = 'tirana'; 

then there 2 ways of checking existence of string. 1 be:

json.stringify(abbreviations).indexof('kabul') >= 0 

and loop through array loop, looking @ each value.


Comments

Popular posts from this blog

javascript - Iterate over array and calculate average values of array-parts -

iphone - Using nested NSDictionary with Picker -

objective c - Newbie question -multiple parameters -