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:

  1. i using java.

  2. i have pasted below response reference. need loop below json array response.

  3. 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

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -