Sunday, 15 April 2012

javascript - Get Name Of Array Object In JSON -


I want names from this Jason like Hem, Madurai

  {"status": "Success", "DisplayList": [{"Avinashi": ["Gmail @ com", "Gmail @ HP.com"]}, {"Avinashi": ["Gmail @ com", "Gmail @ HP.com" ]}, {"ERNAVOOR": ["sri@gmail.com", "sri@gmail.com"]}, {"ERNAVOOR": ["sri@gmail.com", "sri@gmail.com"]} , {"Headcard": ["sri@gmail.com"]}, {"kanchipur": ["sri@gmail.com"]}, {"kelkelaai": ["sri@gmail.com"]}, { "Madurai": ["sri@gmail.com", "sri2@gmail.com"]}, {"Maduri": ["sri@gmail.com", "sri2@gmail.com"]}, {"Salem ": [" Gmail@hp.com "," gmail@hp.com "," gmail@hp1.com "]}, {" Salem ": [" gmail@hp.com "," gmail@hp.com " , "Gmail@hp1.com"]}, {"SALEM": ["gmail@hp.com", "gmail@hp.com", "gmail@hp1.com"]}]}    

  var list = JSONObject ['DisplayList']; (Var i = 0; i & lt; List.length; i ++) {for (var key in the [i] list) {console.log (key); // will print names console.log (list [i] [key]); // will match the array of mail}}   

Assume that you have JSON data in the variable JSONObject

No comments:

Post a Comment