retrofit请求获取返回值的时候retrofit.RetrofitError: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 37 path $.data
进行请求的
((App) getApplication()).getApi().updateAuthorization(access_token, nonce, timestamp, userCode, sign, userPhone, type, approvalinfo, modelIds, new Callback<AuthorityListEntity>() {
@Override
public void success(AuthorityListEntity authorityListEntity, Response response) {
if (authorityListEntity.getMessage() != null) {
if (authorityListEntity.isSuccess()) {
failed(getResources().getString(R.string.authorizesucces));
} else {
String message = authorityListEntity.getMessage();
if ("超时了".equals(message)) {
String nonce = NetWorkUtil.getNonce();
String timestamp = NetWorkUtil.getTimestamp();
String refreshToken = SharedPreferencesUtils.getString(context, Constants.REFRESHTOKEN, "");
String code = SharedPreferencesUtils.getString(context, Constants.USERCODE, "");
String sign = new Md5().getMD5ofStr("refreshToken" + "=" + refreshToken + "&" + "userCode" + "=" + code + Constants.SIGNMANTISSA).toLowerCase();
refresh_1(nonce, timestamp, sign, refreshToken, code);
} else {
if (!TextUtils.isEmpty(message)) {
failed(MessageUtils.setMessage(context, message));
}
}
}
返回值
{"accountOperationType":"2","data":{},"message":"编辑授权成功","modelIds":null,"page":0,"success":true,"total":0,"totalPages":0}
下面是bean
public class AuthorityListEntity {
private String message;
private int page;
private boolean success;
private int total;
private String accountOperationType;
private List<String> modelIds;
private List<DataBean> data;
private int totalPages;
public List<String> getModelIds() {
return modelIds;
}
public void setModelIds(List<String> modelIds) {
this.modelIds = modelIds;
}
public String getAccountOperationType() {
return accountOperationType;
}
public void setAccountOperationType(String accountOperationType) {
this.accountOperationType = accountOperationType;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public int getTotalPages() {
return totalPages;
}
public void setTotalPages(int totalPages) {
this.totalPages = totalPages;
}
public List<DataBean> getData() {
return data;
}
public void setData(List<DataBean> data) {
this.data = data;
}
public class DataBean {
private String userPhone;
private String deviceAddress;
private int deviceNum;
private String name;
private String icon;
private String isAuthorited;
private String roomCode;
private String deviceCode;
private String type;
private String userCode;
private String accountOperationType;
private String validationCode;
public String getAccountOperationType() {
return accountOperationType;
}
public void setAccountOperationType(String accountOperationType) {
this.accountOperationType = accountOperationType;
}
public String getValidationCode() {
return validationCode;
}
public void setValidationCode(String validationCode) {
this.validationCode = validationCode;
}
public String getUserPhone() {
return userPhone;
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
}
public String getDeviceAddress() {
return deviceAddress;
}
public void setDeviceAddress(String deviceAddress) {
this.deviceAddress = deviceAddress;
}
public int getDeviceNum() {
return deviceNum;
}
public void setDeviceNum(int deviceNum) {
this.deviceNum = deviceNum;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getIsAuthorited() {
return isAuthorited;
}
public void setIsAuthorited(String isAuthorited) {
this.isAuthorited = isAuthorited;
}
public String getRoomCode() {
return roomCode;
}
public void setRoomCode(String roomCode) {
this.roomCode = roomCode;
}
public String getDeviceCode() {
return deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getUserCode() {
return userCode;
}
public void setUserCode(String userCode) {
this.userCode = userCode;
}
}
}