Retrofit Gson : Expected BEGIN_ARRAY but was BEGIN_OBJECT (Not duplicate)
<p>Please I tried two approaches to solve this problem but both doesn't work, I don't know what did happen but before it works without problem.
I have the following json : </p>

<pre><code>{
  "_embedded" : {
    "posts" : [ {
      "postid" : 1,
      "taggedusers" : null,
      "hashtags" : null,
      "createdAt" : "2016-05-07",
      "commentsCount" : 0,
      "likesCount" : 0,
      "shareCount" : 0,
      "description" : "nothing",
      "post" : "nothing",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/posts/1"
        },
        "postsEntity" : {
          "href" : "http://localhost:8080/posts/1"
        },
        "usersByUserid" : {
          "href" : "http://localhost:8080/posts/1/usersByUserid"
        },
        "commentsesByPostid" : {
          "href" : "http://localhost:8080/posts/1/commentsesByPostid"
        }
      }
    }, {
      "postid" : 2,
      "taggedusers" : null,
      "hashtags" : null,
      "createdAt" : "2016-05-07",
      "commentsCount" : 0,
      "likesCount" : 0,
      "shareCount" : 0,
      "description" : "nothing",
      "post" : "nothing",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/posts/2"
        },
        "postsEntity" : {
          "href" : "http://localhost:8080/posts/2"
        },
        "usersByUserid" : {
          "href" : "http://localhost:8080/posts/2/usersByUserid"
        },
        "commentsesByPostid" : {
          "href" : "http://localhost:8080/posts/2/commentsesByPostid"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/users/6/postsesByUserid"
    }
  }
}
</code></pre>

<p>I tried to read it using the following in retrofit : </p>

<pre><code> Retrofit retrofit = RetrofitGenerator.initRetrofit(CacheUtils.readSharedPreference(getActivity()).getToken());
        PostService postService= retrofit.create(PostService.class);
         postService.getUsersPost((int) CacheUtils.readSharedPreference(getActivity()).getUserID()).enqueue(new Callback&lt;List&lt;Post&gt;&gt;() {
             @Override
             public void onResponse(Call&lt;List&lt;Post&gt;&gt; call, Response&lt;List&lt;Post&gt;&gt; response) {
                 if(response.isSuccessful()){
                     List&lt;Post&gt; postEntitiyList = response.body();

                 }
             }

             @Override
             public void onFailure(Call&lt;List&lt;Post&gt;&gt; call, Throwable t) {
                 Log.e("teeest",t.getMessage());
             }
         });
</code></pre>

<p>and for Interface :</p>

<pre><code>public interface PostService {
    @Headers("Content-Type:application/json")
    @GET("/posts")
    Call&lt;List&lt;Post&gt;&gt; getAllPosts();

    @Headers("Content-Type:application/json")
    @GET("users/{id}/postsesByUserid")
    Call&lt;List&lt;Post&gt;&gt; getUsersPost(@Path("id") int id);
}
</code></pre>

<p>But I get this problem : Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $
I tried to make the Post Pojo in another class like the following :</p>

<pre><code>public class PostEntitiy {
    private Post post;

    public PostEntitiy(Post post) {
        this.post = post;
    }

    public Post getPost() {
        return post;
    }

    public void setPost(Post post) {
        this.post = post;
    }
}
</code></pre>

<p>Then I used List still I get the same problem , what the wrong thing I use?</p>