title: When i'm using volley in android studio how to get response and iterate over Json ? if it is multi-dimensional array
body: <p>I can't use JsonObjectRequest instead of StringRequest because I need send it via POST method </p>
  
  <p>After analyzing lot of solutions I posted the question here</p>
  
  <p>My php api output is looks like</p>
  
  <pre><code>[
    {
      "username": "arun",
      "password": "kumar"
    },
    {
      "username": "arun",
      "password": "ak"
    },
    {
      "username": "arun",
      "password": "mypass"
    },
    {
      "username": "arun",
      "password": "TestPW"
    }
  ]
  </code></pre>
  
  <p>In Android side I am using below code to fetch data from web, in the method
      public void onresponse()
  I don't know how to get above json response, and also iterate over response to print all data in response </p>
  
  <pre><code>String url = "http://myipaddress/index.php";
  
  StringRequest request = new StringRequest(Request.Method.POST, url, new response.Listener&lt;String&gt;() {
    @Override
    public void onResponse(String response) {
      try {
        JSONObject jsonobject = new JSONObject(response);
        String output = "";
        for (int i = 0; i &lt; jsonobject.length(); i++) {
          // print all usernames and passwords
        }
  
      } catch (JSONException e) {
        e.printStackTrace();
      }
  
    }
  }, new Response.ErrorListener() {
    @Override
    public void onErrorResponse(VolleyError error) {
  
    }
  }) {
    @Override
    protected Map&lt;String, String&gt; getParams() throws AuthFailureError {
      Map&lt;String, String&gt; params = new HashMap&lt;&gt;();
      params.put("username", username);
      return params;
    }
  };
  
  RequestQueue requestQueue = Volley.newRequestQueue(this);
  requestQueue.add(request);
  </code></pre>