I'm trying to get just the values of a JSONArray that i can store to a ArrayList or an Array. My Code is this at the moment:
JSONArray params = (JSONArray) res.get("params");
for (int j = 1; j <= params.size(); j++){
Object chatter = params.get(j);
String chatterName = chatter.toString();
System.out.println("ChatterName: "+chatterName);
int index = 2;
listModel.add(index, chatterName);
index++;
}
My problem is that i get the keys too:
ChatterName: Steve
ChatterName: Blubb
ChatterName: 2
ChatterName: 3
ChatterName: Joey
ChatterName: 4
ChatterName: Chris
This is the JSON looks like:
Input Stream(Response vom Server): {"statuscode":"200","sequence":1382,"response":"sendWho","params":["1","Steve","Blubb","2","3","Joey","4","Chris"]}