A PHP script is sending to an Android app some data in the following format
[{"event_id":"4","message":"test"},["person1","person2"]]
I want to exact the 2 elements from this array into other arrays so I can easily manipulate the data. I got to the point in which the above response from the server is being converted into as string. What I can't seem to be able to do is to parse the data into arrays. I'm trying something on the following lines:
receivedData = new JSONArray(result); //result is the string response from the server JSONArray array1= receivedData.getJSONArray(0); JSONArray array2= receivedData.getJSONArray(1); int len = array1.length();
but len
is not giving me back anything :(
What am I doing wrong and how could I change it.
Many thanks