title: Receiving JSON String Using Volley
body: <p>My Node.js server sends an array consisting of JSON documents from MongoDB, but my Android app won't download it. I sent it using <code>response.send(placearray);.</code> However, if I send a plain string like <code>Request received</code>, it works perfectly.</p>
  
  <p>I used a POST request sender to test the server, and it receives the array just fine, but Volley won't.</p>
  
  <p>I understand the fact that I'm receiving it in a string may be causing this, but I don't know what to do.</p>
  
  <p>Here is the procedure I used:</p>
  
  <pre><code>StringRequest PlaceRequest = new StringRequest(Request.Method.POST, url, new      Response.Listener&lt;String&gt;() {
          @Override
          public void onResponse(String response) {
              DisplayHotels(response);
          }
      }, new Response.ErrorListener() {
          @Override
          public void onErrorResponse(VolleyError error) {
  
          }
      }) {
          protected Map&lt;String, String&gt; getParams() {
              Map&lt;String, String&gt; PlaceMap = new HashMap&lt;&gt;();
              PlaceMap.put("Test", "Test");
              return PlaceMap;
          }
      };
      PlaceQueue.add(PlaceRequest);
  </code></pre>
  
  <p>As Fakher suggested, I just tried this, but it still isn't working:</p>
  
  <pre><code>    JsonArrayRequest PlaceArrayRequest = new JsonArrayRequest(Request.Method.POST, url, new Response.Listener&lt;JSONArray&gt;() {
          @Override
          public void onResponse(JSONArray response) {
              ArrayList MArrList = new ArrayList();
              //MArrList.add(response);
              DisplayHotels(response.toString());
          }
      }, new Response.ErrorListener() {
          @Override
          public void onErrorResponse(VolleyError error) {
              Context context = getApplicationContext();
              Toast VerrorToast = Toast.makeText(context, error.toString(), Toast.LENGTH_LONG);
          }
      }) {
          protected Map&lt;String, String&gt; getParams() {
              Map&lt;String, String&gt; PMap = new HashMap&lt;&gt;();
              PMap.put("Hotels", "All");
              return PMap;
          }
      };
  </code></pre>
  
  <p>It now receives the JSONArray, but it won't parse it, and this is the code I tried: </p>
  
  <p>RequestQueue PlaceQueue = Volley.newRequestQueue(this);</p>
  
  <pre><code>    JsonArrayRequest PlaceArrayRequest = new JsonArrayRequest(Request.Method.POST, url, new Response.Listener&lt;JSONArray&gt;() {
          @Override
          public void onResponse(JSONArray response) {
              int i;
              ArrayList&lt;String&gt; MArrList = new ArrayList&lt;&gt;();
  
                  for (i = 0; i &lt; response.length(); i++) {
                      try {
                          JSONArray ConvertedJarray = response.getJSONArray(i);
                          JSONObject PlaceParser = ConvertedJarray.getJSONObject(i);
                          MArrList.add(PlaceParser.get("PlaceName").toString());
                              MArrList.add(response.get(i).toString());
                      } catch (JSONException e) {
                          e.printStackTrace();
                      }
  
                  }
  </code></pre>
  
  <p>I get this error: org.json.JSONException: Value {"_id":"55f97b849b8385cd03730b09","PlaceName":"W South Beach","PlaceType":"Hotel","PlaceAddress":"2201 Collins Avenue, Miami Beach, Florida, United States. Zip code: 33139.","PlaceCity":"Miami","EstimatedPrice":"2023","OtherDetails":"Cool Corner Suite.\nPanoramic ocean view.\nVIP amenities.\nRoom size: 1,350 sq ft (125 sq metres).\nNo smoking.\n"} at 108 of type java.lang.String cannot be converted to JSONArray</p>
  
  <p>Thank you for your time.</p>