Skip to content Skip to sidebar Skip to footer

Retrofit: Expected Begin_array But Was Begin_object At Line 1 Column 2

I'm using Retrofit for the first time, leaving behind the traditional httpclient with AsyncTask. And I am having issues understanding how Retrofit really works. Am getting this Err

Solution 1:

Your Interface should look like this:

publicinterfaceGitHubAPI { 
    @GET("/users/basil2style")publicvoidgetFeed( Callback<GitHub> response);
} 

and your callback:

gitapi.getFeed(newCallback<GitHub>() {
            @Overridepublicvoidsuccess(GitHub github, Response response) { 
                Github example = github; 
                //Log.d("Size: ", Integer.toString(examplelist.size())); 
            } 

            @Overridepublicvoidfailure(RetrofitError error) { 
                Log.d("Error: ", error.getLocalizedMessage()); 
            } 
        }); 

Post a Comment for "Retrofit: Expected Begin_array But Was Begin_object At Line 1 Column 2"