Je suis nouveau départ avec Retrofit quand je suis en train d'obtenir des données de formulaire api utiliser Retrofit2 + Rxjava:
ApiService :
@GET("news/get_comments/{newsid}/{count}/{offset}")
Observable<ResultResponse<CommentList>> getComment(@Header("api_key") String key, @Path("newsid") String newsid, @Path("count")String count, @Path("offset")String offset);
public void getComment(String item_id, int pageNow) {
int offset = (pageNow - 1) * 10;
Log.i("commentlist", offset+"");
Log.i("commentlist",pageNow+"");
addSubscription(AppClient.getApiService().getComment(ApiService.KEY,item_id,"10",offset+""), new SubscriberCallBack<CommentList>() {
@Override
protected void onSuccess(CommentList response) {
Logger.i("commentist",response.toString());
mvpView.onGetCommentSuccess(response);
}
});
}
GSON lancer une erreur: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 41 path $.data
Ajouter JSON vous revenir. ajoutez également les objets ResultResponse et CommentList que vous avez créés – TooManyEduardos