title: how to code json array without array name?
body: <p>I'm new to JSON android java eclipse. I am doing a listview with images and parsing json array. I followed this tutorial: <a href="http://www.wingnity.com/blog/android-json-parsing-and-image-loading-tutorial/" rel="nofollow">http://www.wingnity.com/blog/android-json-parsing-and-image-loading-tutorial/</a> . In that tutorial, their JSON array contains the array name.However, mine doesn't contain the array name. So my question is how to code JSON Array without the array name? </p>
  
  <p>Below is my JSON code. </p>
  
  <pre><code>[
  
   {  "event_id": "EV00000001",
      "event_title": "Movie 1",   
  },
  {
      "event_id": "EV00000002",
      "event_title": "Movie2",
      }
  ]
  </code></pre>
  
  <p>Below is my JSON coding for parsing the JSON.</p>
  
  <pre><code>  protected Boolean doInBackground(String... urls) {
  
      try { 
  HttpGet httppost = new HttpGet(urls[0]);
      HttpClient httpclient = new DefaultHttpClient();
      HttpResponse response = httpclient.execute(httppost);
  
      // StatusLine stat = response.getStatusLine();
      int status = response.getStatusLine().getStatusCode();
  
      if (status == 200) {
          HttpEntity entity = response.getEntity();
          String data = EntityUtils.toString(entity);
  
  
          JSONObject jsono = new JSONObject(data);
          JSONArray jarray = jsono.getJSONArray("actors"); 
  
          for (int i = 0; i &lt; jarray.length(); i++) {
              JSONObject object = jarray.getJSONObject(i);
  
              Events event = new Events();
  
              event.setevent_title(object.getString("event_title"));
  
  
              eventList.add(event);
          }
          return true;
      }
  
      //------------------&gt;&gt;
  
  } catch (ParseException e1) {
      e1.printStackTrace();
  } catch (IOException e) {
      e.printStackTrace();
  } catch (JSONException e) {
      e.printStackTrace();
  }
  return false;
  }
  </code></pre>
  
  <p>What am i suppose to do?</p>
  
  <p>This problem is solved. Thus, i will be posting the correct code. </p>
  
  <pre><code>protected Boolean doInBackground(String... urls) {
              try {
  
                  //------------------&gt;&gt;
                  HttpGet httppost = new HttpGet(urls[0]);
                  HttpClient httpclient = new DefaultHttpClient();
                  HttpResponse response = httpclient.execute(httppost);
  
                  // StatusLine stat = response.getStatusLine();
                  int status = response.getStatusLine().getStatusCode();
  
                  if (status == 200) {
                      HttpEntity entity = response.getEntity();
                      String data = EntityUtils.toString(entity);
  
                  JSONArray array = new JSONArray(data);
  
                  for (int i = 0; i &lt; array.length(); i++) {
  
                      JSONObject obj = array.getJSONObject(i);
  
                      Events event = new Events();
  
                      event.setevent_title(obj.getString("event_title"));
  
                      eventList.add(event);
  
  
                  }
                  return true;
              }
  
              //------------------&gt;&gt;
  
          } catch (ParseException e1) {
              e1.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          } catch (JSONException e) {
              e.printStackTrace();
          }
          return false;
      }
  </code></pre>