Raghuveer Rawat wrote:
{"match":["Chicago","California","Calcutta"],
"AllTag":["Newyork","Paris","London","Chicago","California","Calcutta"]}
I have to write a function which will look for string "match" in above
JSON formatted string and will return JSON array associated with
it...so for above string my output will be
["Chicago","California","Calcutta"]
This has nothing to do with jQuery. It's fairly simple using "eval":
var obj, string = '{"match":["Chicago","California","Calcutta"],
"AllTag":["Newyork","Paris","London","Chicago","California","Calcutta"]}';
eval("obj="+string);
alert(obj.match);
-- Scott