GSON报错Expected BEGIN_ARRAY but w
GSON报错Expected BEGIN_ARRAY but was STRING
其实这个错误,从字面意思就很明白的,但是我折腾了半天,主要是postman请求过来正确的数据去验证,但是实际app请求的不是这个正确的数据,这个json是[]引用的ARRAY(有数据的时候)但是呢没有数据的时候返回用STRING
- 错误的json
{
"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"
}
]
}