I have JSON Data Like this: I have little confused by getting these json data.
JSONObject jb = (JSONObject)entries.getJSONObject("data");
Log.d("Geting Value---", "+----"+jb.length()); //here i got 6 length.
for (int i = 0; i < jb.length(); i++) {
JSONObject postListObj = jb.getJSONObject("1");
String Title = postListObj.getString("title");
namelist.add(Title);
}
if i JSONObject postListObj = jb.getJSONObject("1"); then getting all data in list, but it is not my way.
I want to get JSON data of user id here 2 in list all title.
JSON Data
{
"get": [],
"post": {
"event": "datajson",
"user_id": "2"
},
"data": {
"3": {
"ID": 1,
"title": "A"
},
"4": {
"ID": 2,
"title": "B"
},
"5": {
"ID": 5,
"title": "X"
},
"6": {
"ID": 1172,
"title": "dsfsdf"
},
"7": {
"ID": 34,
"title": "CX"
},
"8": {
"ID": 8,
"title": "Z"
}
}
}
SO, How to get these json data and i want to store in list id and titles. My main intention is display these title in list and if i click CX get id of clicked. display on toast for propose of delete this clicked.(post to web clicked list item.)