Ошибка
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 36 path $.data[0].object
@GET("?act=auth")
Call<AuthResponse> auth(@Query("login") String login, @Query("password") String password);
Вот Json:
{"data":[{"success":true,"object":{"id":"18","phone":"(444)444-4444","dop_phone":"(222)111-1111","email":"abaaaba@mail.kz","name":"beka","city":"turkestan","address":"mkrTGJ","user_type":"0"},"errors":""}]}
btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String number = eTxtUsername.getText().toString();
String password = eTxtPassword.getText().toString();
ApiInterface apiInterface = ApiClient.getClient().create(ApiInterface.class);
Call<AuthResponse> call = apiInterface.auth(number,password);
Log.i("ssss",""+call);
if(call == null)
Log.i("ssss",""+1);
else
Log.i("ssss",""+2);
call.enqueue(new Callback<AuthResponse>() {
@Override
public void onResponse(Call<AuthResponse> call, Response<AuthResponse> response) {
Log.i("ssss",""+2322);
@Override
public void onFailure(Call<AuthResponse> call, Throwable t) {
Log.i("ssss",""+t);
}
});
}
});
public class AuthResponse {
@SerializedName("data")
@Expose
private List<DataAuth> data = new ArrayList<DataAuth>();
@NonNull
public List<DataAuth> getData() {
return data;
}
public void setData(@NonNull List<DataAuth> data) {
this.data = data;
}
}
public class DataAuth {
@SerializedName("success")
@Expose
private boolean success;
@SerializedName("object")
@Expose
private List<InfoClient> infoClients = new ArrayList<InfoClient>();
@SerializedName("errors")
@Expose
private String errors;
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public List<InfoClient> getInfoClients() {
return infoClients;
}
public void setInfoClients(List<InfoClient> infoClients) {
this.infoClients = infoClients;
}
public String getErrors() {
return errors;
}
public void setErrors(String errors) {
this.errors = errors;
}
}
public class InfoClient {
@SerializedName("id")
@Expose
private String id;
@SerializedName("phone")
@Expose
private String phone;
@SerializedName("dop_phone")
@Expose
private String dopPhone;
@SerializedName("email")
@Expose
private String email;
@SerializedName("name")
@Expose
private String name;
@SerializedName("city")
@Expose
private String city;
@SerializedName("address")
@Expose
private String address;
@SerializedName("user_type")
@Expose
private String userType;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getDopPhone() {
return dopPhone;
}
public void setDopPhone(String dopPhone) {
this.dopPhone = dopPhone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getUserType() {
return userType;
}
public void setUserType(String userType) {
this.userType = userType;
}
}
AuthResponse
Покажите код этого класса.