java - How to loop and get the specific value of the json object ,how can i use that json object to get the other entity present in that json object? -
this question has answer here:
- how loop through json array? 7 answers
i using java.
i have pasted below response reference. need loop below json array response.
i can able full response. but, need access device type first example:devicetype=android , using device type need id of particular device type example: id=16.
response: { "bannerconfigurations": [ { "id": 16, "partnerid": 69, "appid": "28470216", "affiliatedata": "", "status": true, "devicetype": "ios", "dayshidden": 15, "daysreminder": 30 }, { "id": 161, "partnerid": 69, "appid": "com.android.news", "affiliatedata": "", "status": true, "devicetype": "android", "dayshidden": 15, "daysreminder": 30 } ] }
i'm assuming starting full jsonobject can skip first line if you've banner configurations array.
jsonobject data = [insert following structure above]; jsonarray bannerconfigurations = data.get("bannerconfigurations"); (int i=0; i<bannerconfigurations.length(); i++) { jsonobject device = bannerconfigurations.getjsonobject(i); string devicetype = device.getstring("devicetype"); int id = device.getint("id"); // stuff! }
Comments
Post a Comment