Issue
I have following JSON Object
{"LIST":{"row_12":{"id":"11","name":"blah blah"},
"row_13":{"id":"8","name":"blah blah"},
"row_10":{"id":"3","name":"blah blah"},
"row_11":{"id":"14","name":"blah blah"},
"row_2":{"id":"27","name":"blah blah"},
"row_1":{"id":"2","name":"blah blah"},
"row_4":{"id":"23","name":"blah blah"},
"row_14":{"id":"43","name":"blah blah"},
"row_15":{"id":"35","name":"blah blah"},
"row_3":{"id":"36","name":"blah blah"},
"row_5":{"id":"30","name":"blah blah"},
"row_6":{"id":"34","name":"blah blah"},
"row_7":{"id":"17","name":"blah blah"},
"row_8":{"id":"37","name":"blah blah"},
"row_9":{"id":"1","name":"blah blah"}}}
I want to convert it to List I tried several codes from the answers to questions which are similar to mine, however they didn`t work, I think it is because each object in row has its name. How can I convert the object to List .
Solution
JSONObject list = response.getJSONObject("LIST");
JSONObject rowOne = list.getJSONObject("row_12");
String id = rowOne.getString("id");
String name = rowOne.getString("name");
You follow this procedure 14 times, since your responses key,value pair is different. You should ask kor an JSONArray inside list for each row. "response" is the JSONObject you receive on your on Async recieve method. Hope it helps. [PS: your question is a bad practice in stackOverFlow. Please check this link to see stackOverFlow's question posting method.] Cheers!
Answered By - O_o
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.