text: Q:
  
  Managment of JSON objects and JSON arrays
  
  I'm new with JSON and my question might be not very hard, but I can not find the way to deal with my purpose.
  I'm trying to develop the code so that I can manage some JSON content. In my case the JSON info is:
  {"posts":[{"id":1a00b,"name":"Michael Thomson","info":"he is crazy"},
  {"id":18,"name":"Jason Williams","info":"he is tall"}]}
  
  Now, I'd like to get the strings from each JSON object (using Java). That's the code I have developed:
  HttpResponse response = httpclient.execute(httppost);           
  String jsonResult = inputStreamToString(response.getEntity().getContent()).toString();                      
  JSONArray jsonArray = jsonResult.getJSONArray("posts");
  
  for (int i = 0; i < jsonArray.length(); i++) 
  {
       JSONObject childJSONObject = jsonArray.getJSONObject(i);
       String id = childJSONObject.getString("id");
       String name = childJSONObject.getString("name");
       String info = childJSONObject.getString("info");
  }
  
  The error seems to be related with the sentence:
  JSONArray jsonArray = jsonResult.getJSONArray("posts");
  
  The method getJSONArray(String) is undefined for the type String
  
  Those are the libraries I'm using to deal with
  import org.json.JSONException;
  import org.json.JSONObject;
  import org.json.JSONArray; 
  
  Thank you very much in advance!
  
  A:
  
  jsonResult is a String. You need to turn it into a JSONObject first.
  JSONObject obj = new JSONObject(jsonResult);
  JSONArray jsonArray = obj.getJSONArray("posts");
  
  