title: Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2
body: <p>I am trying to parse gson response in the form of:</p>
  
  <pre><code>{"movie_list":[
             {"movie_id":"1","movie_name":"Avatar 2009"},                
             {"movie_id":"2","movie_name":"Titanic"}
             ]}
  </code></pre>
  
  <p>Using GSON library, like this:</p>
  
  <pre><code>        GsonBuilder builder = new GsonBuilder();
          Gson gson = builder.create();
          movieList = new ArrayList&lt;MovieList&gt;();
          movieList = Arrays.asList(gson.fromJson(reader, MovieList[].class));
  </code></pre>
  
  <p>I have made a MovieList class:</p>
  
  <p>public class MovieList {</p>
  
  <pre><code>@SerializedName("movie_id")
  public String movieId;
  
  @SerializedName("movie_name")
  public String movieName;
  
  public String getMovieId() {
      return movieId;
  }
  
  public void setMovieId(String movieId) {
      this.movieId = movieId;
  }
  
  public String getMovieName() {
      return movieName;
  }
  
  public void setMovieName(String movieName) {
      this.movieName = movieName;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>But getting this exception:</p>
  
  <pre><code>    01-19 15:48:09.425: E/AndroidRuntime(4868): FATAL EXCEPTION: AsyncTask #1
  01-19 15:48:09.425: E/AndroidRuntime(4868): Process: com.example.autocompletetextviewdemo, PID: 4868
  01-19 15:48:09.425: E/AndroidRuntime(4868): java.lang.RuntimeException: An error occured while executing doInBackground()
  01-19 15:48:09.425: E/AndroidRuntime(4868):     at android.os.AsyncTask$3.done(AsyncTask.java:300)
  01-19 15:48:09.425: E/AndroidRuntime(4868):     at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
  01-19 15:48:09.425: E/AndroidRuntime(4868):     at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
  01-19 15:48:09.425: E/AndroidRuntime(4868):     at java.util.concurrent.FutureTask.run(FutureTask.java:242)
  01-19 15:48:09.425: E/AndroidRuntime(4868):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
  01-19 15:48:09.425: E/AndroidRuntime(4868):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
  01-19 15:48:09.425: E/AndroidRuntime(4868):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
  01-19 15:48:09.425: E/AndroidRuntime(4868):     at java.lang.Thread.run(Thread.java:841)
  01-19 15:48:09.425: E/AndroidRuntime(4868): Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2
  01-19 15:48:09.425: E/AndroidRuntime(4868):     at com.google.gson.Gson.fromJson(Gson.java:815)
  01-19 15:48:09.425: E/AndroidRuntime(4868):     at com.google.gson.Gson.fromJson(Gson.java:741)
  01-19 15:48:09.425: E/AndroidRuntime(4868):     at com.example.autocompletetextviewdemo.MainActivity$AutoCompleteText.doInBackground(MainActivity.java:152)
  01-19 15:48:09.425: E/AndroidRuntime(4868):     at com.example.autocompletetextviewdemo.MainActivity$AutoCompleteText.doInBackground(MainActivity.java:1)
  01-19 15:48:09.425: E/AndroidRuntime(4868):     at android.os.AsyncTask$2.call(AsyncTask.java:288)
  01-19 15:48:09.425: E/AndroidRuntime(4868):     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
  01-19 15:48:09.425: E/AndroidRuntime(4868):     ... 4 more
  01-19 15:48:09.425: E/AndroidRuntime(4868): Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2
  01-19 15:48:09.425: E/AndroidRuntime(4868):     at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:338)
  01-19 15:48:09.425: E/AndroidRuntime(4868):     at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:70)
  01-19 15:48:09.425: E/AndroidRuntime(4868):     at com.google.gson.Gson.fromJson(Gson.java:803)
  </code></pre>