when i try to get this result from webService :
{
"bankInfo":
[
{
"id": "2",
"title": "BANK A",
"alias": "A"
},
{
"id": "3",
"title": "BANK B",
"alias": "B"
},
{
"id": "4",
"title": "BANK C",
"alias": "C"
}
]
}
with this code:
ActiveBanks activeBanks = new ActiveBanks();
Call<ActiveBanks> call = behandamService.activeBanksCall(activeBanks);
call.enqueue(new Callback<ActiveBanks>() {
@Override
public void onResponse(Call<ActiveBanks> call, final Response<ActiveBanks> response) {
if (response.isSuccessful()) {
}
}
@Override
public void onFailure(Call<ActiveBanks> call, Throwable t) {
t.printStackTrace();
if (t.getMessage() != null) Log.e("ActiveBanks: ", t.getMessage());
}
});
and ActiveBanks
structure :
public class ActiveBanks {
private JSONArray bankInfo;
public ActiveBanks() {
}
public JSONArray getBankInfo() {
return bankInfo;
}
public void setBankInfo(JSONArray bankInfo) {
this.bankInfo = bankInfo;
}
}
i get this error:
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 14 path $.bankInfo