Getting JSON.typeMismatch error
<p>Everytime I run my code I get the following error.</p>

<blockquote>
  <p>JSON.typeMismatch(JSON.java:111)</p>
</blockquote>

<p>How can I parse a <code>JSONObject</code> wrapped with an array?</p>

<p>Here is my code.</p>

<pre><code>public class FeedActivity extends AppCompatActivity implements OnFeedListener {

     ListView listView;
     FeedAdapter adapter;
     ArrayList&lt;Post&gt; posts;

     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_feed);

         listView = (ListView)findViewById(R.id.listView);
         adapter = new FeedAdapter(getApplicationContext(), R.layout.layout_feed_item);
         listView.setAdapter(adapter);

         FeedTask task= new FeedTask(this);
         task.execute("http://www.botswanayouth.com/wp-json/wp/v2/posts");
     }

     @Override
     public void onFeed(JSONArray array) {
         posts= new ArrayList&lt;&gt;();
         int length =  array.length();
         for (int i = 0; i &lt; length; ++i) {
             JSONObject object = array.optJSONObject(i);
             Post post = new Post(object.optString("title"),object.optString("excerpt"),object.optString("featured_media"));
             posts.add(post);
         }
         adapter.addAll(posts);
     }

     public class FeedTask extends AsyncTask&lt;String, Void, JSONArray&gt; {
         private OnFeedListener listener;
         public FeedTask(OnFeedListener listener) {
             this.listener= listener;
         }

         @Override
         protected JSONArray doInBackground(String... params) {

             String url = params[0];
             OkHttpClient client= new  OkHttpClient();
             Request.Builder builder= new Request.Builder();

             Request request= builder.url(url).build();

             try {
                 Response response= client.newCall(request).execute();

                 String json= response.body().string();

                 try {
                     JSONObject object= new JSONObject(json);
                     JSONArray array = object.optJSONArray("posts");

                     return array;
                 } catch (JSONException e) {
                     e.printStackTrace();
                 }

             } catch (IOException e) {
                 e.printStackTrace();
             }
             return null;
         }

         @Override
         protected void onPostExecute(JSONArray array) {
             super.onPostExecute(array);

             if (null== array)
                 return;

             if (null != listener)
                 listener.onFeed(array);
         }
     }

     public class FeedAdapter extends ArrayAdapter&lt;Post&gt; {
         private int resource;

         public FeedAdapter(Context context, int resource) {
             super(context, resource);
             this.resource=resource;
         }

         @Override
         public View getView(int position, View convertView, ViewGroup parent) {

             if (null==convertView) {
                 LayoutInflater inflater=LayoutInflater.from(getContext());
                 convertView=inflater.inflate(resource, null);
             }

             Post post = getItem(position);

             TextView title = (TextView) convertView.findViewById(R.id.title);
             TextView desc = (TextView) convertView.findViewById(R.id.description);
             title.setText(post.title);
             desc.setText(post.description);

             return convertView;
         }
     }

     public class Post {
         public String title;
         public String description;
         public String thumbnail; //URL

         public Post(String title, String desc, String thumbnail) {
             this.title=title;
             this.description=desc;
             this.thumbnail=thumbnail;
         }
     }
}
</code></pre>