GSON报错Expected BEGIN_ARRAY but w

2019-09-14  本文已影响0人  岁月静好浅笑安然

GSON报错Expected BEGIN_ARRAY but was STRING

其实这个错误,从字面意思就很明白的,但是我折腾了半天,主要是postman请求过来正确的数据去验证,但是实际app请求的不是这个正确的数据,这个json是[]引用的ARRAY(有数据的时候)但是呢没有数据的时候返回用STRING

{
"status": 0,
"message": "参数不能为空",
"data":""
}

{
"status": 0,
"message": "参数不能为空",
"data": []
}

{
"status": 1,
"message": "登录成功",
"data": [
{
"ID": 1.0,
"REALNAME": "管理员",
"USERNAME": "admin",
"PASSWORD": "xxxx",
"PHONE": null,
"EMAIL": null,
"OPEX": "0",
"COMPANYID": 1.0,
"COMPANYNAME": "xxxxx",
"DEPARTID": 1.0,
"DEPARTNAME": "动力部",
"FACTORYID": 1.0,
"FACTORYNAME": "厂一",
"STATUS": "1",
"STATUSNAME": "正常",
"LOGINNUM": 0.0,
"MISSTIME": "2019-09-10 14:44:13",
"POST": "管理员",
"GROUPID": 1.0,
"GROUPNAME": "系统管理员",
"DEVICEID": null,
"ADDUSER": 1.0,
"ADDTIME": "2019-07-26 13:15:56",
"UPDUSER": 1.0,
"UPDTIME": "2019-08-23 14:09:55",
"DELFLAG": "0"
}
]
}

所以有数据和没数据的一定要对应上!

已经通知后端妹子去做修改了 o( ̄︶ ̄)o

上一篇下一篇

猜你喜欢

热点阅读