I need to access as String all the single parameters contained in a complex Json.
for example String people=...;
String idPeople=...;
etc.
I've not tried. But i guess it may work.
JSONObject obj = new JSONObject(jsonString);
String id = obj.getString("id");
String error = obj.getString("error");
JSONObject result = obj.getJSONObject("result");
int nPeople = result.getInt("nPeople");
JSONArray people = result.getJSONArray("people");
for(int i = 0 ; i < people.length() ; i++){
JSONObject p = (JSONObject)people.get(i);
String namePeople = p.getString("namePeople");
...
}
if we call the json you post myJsonString,
JSonObject obj = new JSonObject(myJsonString);
JSonObject result = obj.getJSONObject("result");
JSonArray people = result.getJSONArray("people");
int numOfPeople = result.getInt("nPeople");