android - How to show json array object in textview -


how add json array in textview? want show json array object "name" in text view. how do it? how getting single element inside array? want print json array obect name in textview

        jsonobject json2 = new jsonobject(str);          status = json2.getstring("status");         if (status.equals("1")) {                  jsonarray school2 = json2.getjsonarray("data");                          txt1.settext(data2.getstring("name"));                              }     "status":1,  "data":   [   {   "dish_id":"37",   "name":"dish2",   "description":"testing",    "allergen":   "eggs3,walnuts",   "image":"http:\/\/198.57.208.46\/~school\/uploads\/images\/dishes\/egg-biryani.jpg",   "ingredient":"weqweqw23,dsfds"   }    ],   "dish_nutrition":  {"1":     {      "name":"cholesterol , diet",      "qty":"2"   },"2":  {     "name":"cholesterol , diet",     "qty":"1"  }  }  } 

you can access field this:

school2.getjsonobject(0).getstring("name") 

for details in documentation


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -