i have this input:
[
"1",
"2",
"3",
"5",
"6",
"9",
"10"
]
Could anyone tell me how to parse this kind of json file, that I get from the web? It doesn't have any key for the attribute or something like that.
i have this input:
[
"1",
"2",
"3",
"5",
"6",
"9",
"10"
]
Could anyone tell me how to parse this kind of json file, that I get from the web? It doesn't have any key for the attribute or something like that.
You are having JSONArray as your response string so you need to create JSONArray for that
JSONArray jsonArray = new JSONArray(responseString);
Now, you can retrieve the values by their index positions.like,
for(int i = 0; i < jsonArray.length(); i++){
String value = jsonArray.getString(i);
}
Complete code to parse this JSON is,
JSONArray jsonArray = new JSONArray(responseString);
for(int i = 0; i < jsonArray.length(); i++){
String value = jsonArray.getString(i);
}