title: converting json response (from wordpress REST API version-2 Beta) to json array in Android Studio
body: <p>Below is the json response from wordpress:</p>
  
  <pre><code>[{
      "id": 711,
      "date": "2015-09-28T01:00:03",
      "date_gmt": "2015-09-27T19:30:03",
      "guid": {
          "rendered": "http:\/\/www.realcake.in\/?p=711"
      },
      "modified": "2015-09-28T01:51:52",
      "modified_gmt": "2015-09-27T20:21:52",
      "slug": "why-only-and-only-realcake",
      "type": "post",
      "link": "http:\/\/www.realcake.in\/why-only-and-only-realcake\/",
      "title": {
          "rendered": "Why only and only RealCake"
      },
      "content": {
          "rendered": "&lt;p&gt;&lt;img class=\"size-full wp-image-725 aligncenter\" src=\"http:\/\/www.realcake.in\/wp-content\/uploads\/2015\/09\/ONLY-ONLY-REAL-INGREDIENTS-FOR-REALCAKE..jpg\" alt=\"REALCAKE BAKERY IN GURGAON R.\" width=\"940\" height=\"225\" srcset=\"http:\/\/www.realcake.in\/wp-content\/uploads\/2015\/09\/ONLY-ONLY-REAL-INGREDIENTS-FOR-REALCAKE..jpg 940w, 
      },
      "excerpt": {
          "rendered": ""
      },
      "author": 4,
      "featured_media": 0,
      "comment_status": "open",
      "ping_status": "open",
      "sticky": false,
      "format": "standard",
      "categories": [37, 35, 1],
      "tags": [],
      "_links": {
          "self": [{
              "href": "http:\/\/www.realcake.in\/wp-json\/wp\/v2\/posts\/711"
          }],
          "collection": [{
              "href": "http:\/\/www.realcake.in\/wp-json\/wp\/v2\/posts"
          }],
          "about": [{
              "href": "http:\/\/www.realcake.in\/wp-json\/wp\/v2\/types\/post"
          }],
          "author": [{
              "embeddable": true,
              "href": "http:\/\/www.realcake.in\/wp-json\/wp\/v2\/users\/4"
          }]
      }
  }, {
      "id": 420,
      "date": "2015-01-01T18:00:07",
      "date_gmt": "2015-01-01T12:30:07",
      "guid": {
          "rendered": "http:\/\/www.realcake.in\/?p=420"
      },
      "modified": "2015-08-04T23:29:55",
      "modified_gmt": "2015-08-04T17:59:55",
      "slug": "why-choose-muffins-cakes-realcake",
      "type": "post",
      "link": "http:\/\/www.realcake.in\/why-choose-muffins-cakes-realcake\/",
      "title": {
          "rendered": "Why Choose Muffins &amp;#038; Cakes from RealCake Bakery?"
      },
      "content": {
          "rendered": "&lt;div id=\"attachment_423\" style=\"width: 559px\" class=\"wp-caption aligncenter\"&gt;&lt;img class=\" wp-image-423\" src=\"http:\/\/www.realcake.in\/wp-content\/uploads\/2015\/03\/Regular-muffins-e1425386051181-300x148.png\" 
      },
      "excerpt": {
          "rendered": "&lt;p&gt;. Feel free to write to us or call us if [&amp;hellip;]&lt;\/p&gt;\n"
      },
      "author": 4,
      "featured_media": 0,
      "comment_status": "open",
      "ping_status": "open",
      "sticky": false,
      "format": "standard",
      "categories": [35],
      "tags": [44, 41, 46, 40, 45, 42, 38, 39, 43],
      "_links": {
          "self": [{
              "href": "http:\/\/www.realcake.in\/wp-json\/wp\/v2\/posts\/420"
          }],
          "collection": [{
              "href": "http:\/\/www.realcake.in\/wp-json\/wp\/v2\/posts"
          }],
          "about": [{
              "href": "http:\/\/www.realcake.in\/wp-json\/wp\/v2\/types\/post"
          }],
          "author": [{
              "embeddable": true,
              "href": "http:\/\/www.realcake.in\/wp-json\/wp\/v2\/users\/4"
          }]
      }
  }]
  </code></pre>
  
  <p>==>> I am using the code below to get JSONArray:</p>
  
  <pre><code>Response response = client.newCall(request).execute();
  
   //here I am getting the json response(mentioned above) from wordpress rest api   
  
    String json = response.body().string(); 
  
    JSONObject object = new JSONObject(json);
  
  //Below code is giving me null array as I dont have "Array name" in my json response.
  
    JSONArray array = object.optJSONArray("Name of Array in json response");
  </code></pre>
  
  <p>Please help me get JSONArray out of json response. </p>