title: Java: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
body: <p>SOLVED! Check the answers below</p>
  
  <p>I am working with the GitHub repo, want to access the names of the users' repos. The JSON looks like this:</p>
  
  <pre><code> [
        {
           "id": 55848012,
            "name": "Android",
            "full_name": "VyaraGGeorgieva/Android"
            ...
            ...
  }
  ]
  </code></pre>
  
  <p>I have a Repo class</p>
  
  <pre><code>public class Repo {
  
  @SerializedName("name")
  private String name;
  
  public String getName() {
      return name;
  }
  
  public void setName(String name) {
      this.name = name;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>And a class, storing the returned query:</p>
  
  <pre><code>public class GitHubRepos {
  
  private Repo[] repos;
  
  public Repo[] getRepos() {
      return repos;
  }
  
  public void setRepos(Repo[] repos) {
      this.repos = repos;
  }
  </code></pre>
  
  <p>The endPoint is defines as this:</p>
  
  <pre><code> @GET("/users/{user}/repos")
  Call&lt;List&lt;GitHubRepos&gt;&gt; getRepoName(@Path("user") String name);
  </code></pre>
  
  <p>When I try to execute the calling:</p>
  
  <pre><code>call.enqueue(new Callback&lt;List&lt;GitHubRepos&gt;&gt;() {
          @Override
          public void onResponse(Call&lt;List&lt;GitHubRepos&gt;&gt; call, Response&lt;List&lt;GitHubRepos&gt;&gt; response) {
              Repo[] repos = response.body().**getRepos()**;
              Log.d("Repos: ", "Number of repos received: " + repos.length);
          }
  </code></pre>
  
  <p>Defined on this way, I can't access the getRepos() method.</p>
  
  <p>I don't define correctly some types, but not sure how to fix the problem.</p>