title: jsonResponse.getJSONArray not working
body: <p>I'm trying to fetch data from MySQL database which is on web server.
  my goal is to retrieve array of location data which is already on MySQL database.
  I'm getting this array of data from server,but I cant convert it from jsonResponse.getJSONArray to JSONArray object.</p>
  
  <pre><code>private void setUpMap() {
      Response.Listener&lt;String&gt; responseListener=new Response.Listener&lt;String&gt;(){
  
          @Override
          public void onResponse(String s) {
              try {
                  JSONObject jsonResponse=new JSONObject(s);
                  boolean success=jsonResponse.getBoolean("success");
                  if(success){             //this is true, and also all the data is arrived
                      JSONArray jsonArray = jsonResponse.getJSONArray("data");   //after this line it doesnt work,it doesn't enter in for loop
                      JSONObject jsonObject;
                      for(int i=0;i&lt;jsonArray.length();i++){
                      jsonObject=jsonArray.getJSONObject(i);
                      String mac=jsonObject.getString("mac");
                      String android_id=jsonObject.getString("android_id");
                      Double latitude=jsonObject.getDouble("latitude");
                      Double longitude=jsonObject.getDouble("longitude");
                      if(!isMarkerOnArray(markerCollection,latitude,longitude))
                      markerCollection.add(mMap.addMarker(new MarkerOptions().position(new LatLng(latitude,longitude))));
                      }
  
                  }
                  else{
                      AlertDialog.Builder builder=new AlertDialog.Builder(MapsActivity.this);
                      builder.setMessage("Downloading position failed")
                              .setNegativeButton("retry",null)
                              .create()
                              .show();
                  }
              } catch (JSONException e) {
                  e.printStackTrace();
              }
          }
      };
      DownloadPosition downloadPosition=new DownloadPosition(responseListener);
      RequestQueue queue= Volley.newRequestQueue(MapsActivity.this);
      queue.add(downloadPosition);
  
  
  }
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/CH4uM.png" rel="nofollow">debug</a></p>
  
  <p>this is my php script</p>
  
  <pre><code>`&lt;?php
  $con=mysqli_connect("","","","");
  $sql="SELECT * FROM positions";
  $result=mysqli_query($con,$sql);
  $response["data"]=array();
  $data=array();
  $data["success"]=false;
  $i=0;
  while($rs = mysqli_fetch_assoc($result)){
      $data["success"]=true;
      $data[$i] = array('id'=&gt;$rs['id'],'mac'=&gt;$rs['mac'], 'android_id'=&gt;$rs['android_id'], 'latitude'=&gt; $rs['latitude'],'longitude'=&gt; $rs['longitude']);
      $i++;
  }
  echo json_encode($data);
  mysqli_close($con);
  ?&gt;`
  </code></pre>
  
  <p>so my question is how can I get JSONArray object from jsonResponse.getJSONArray() ?</p>
  
  <p><strong>edit:</strong>
  <a href="http://i.stack.imgur.com/vm5UU.png" rel="nofollow">this is json</a></p>