Skip to content Skip to sidebar Skip to footer

How To Fix This Error Java.lang.illegalstateexception: Expected Begin_array But Was Begin_object At Line 1 Column 2 Path $

I'm implementing a restful client using Android. I have API URL, token, etc. I implement this application using Retrofit 2 library, all are correct. But the JSON values do not disp

Solution 1:

i think your api interface class should be :

@GET("api/deposits")
Call<User> getDeposits();

and in your Activity :

Call<User> call = service.getDeposits();
call.enqueue(new Callback<User>(){
    @Overridepublic void onResponse(Call<User>call, retrofit2.Response<User>response) {

            List<Deposit> = response.getDeposits();

           }

    }

Post a Comment for "How To Fix This Error Java.lang.illegalstateexception: Expected Begin_array But Was Begin_object At Line 1 Column 2 Path $"