Android开发。。。为啥报这个异常呢?请问我这哪里不对吗?如何解决这个问题呢? try{ AppMessage message = JSON.parseObject(json, AppMessage.class); ...... } catch (Exception e){ e.printStackTrace(); }
AppMessage 如下: private String type; private String code; private String content; private JSONObject data;
后台返回的json字符串如下(这个json会报标题的异常,还有个json不会报异常的贴在最下面):
{
"type": "success",
"code": "10000",
"content": "成功",
"anchor": "undefined",
"errorFields": [],
"data": [{
"pack_quantity": 1.00,
"memo": "",
"modify_date": 1520992993000,
"creater": null,
"stock_in": 61,
"insttu": "60020",
"pack_capacity": 10.00,
"product": 14,
"id": 70,
"modifier": null,
"amount": 200.00,
"buy_detail": 103,
"price": 20.00,
"create_date": 1520992993000,
"quantity": 10.00,
"produce_date": null
}, {
"pack_quantity": 20.00,
"memo": "",
"modify_date": 1520992993000,
"creater": null,
"stock_in": 61,
"insttu": "60020",
"pack_capacity": 1.00,
"product": 62,
"id": 71,
"modifier": null,
"amount": 220.00,
"buy_detail": 104,
"price": 11.00,
"create_date": 1520992993000,
"quantity": 20.00,
"produce_date": null
}]
}
下面这种就不会报异常。。。。
{
"type": "success",
"code": "10000",
"content": "成功",
"anchor": "undefined",
"errorFields": [],
"data": {
"content": [{
"id": 61,
"insttu": "60020",
"modify_date": 1520992993000,
"stock_in_date": 1520956800000,
"stock_in_no": "S8000600010",
"amount": 420.00,
"memo": "",
"status": 1,
"name": "大地经销商",
"statuStr": "待确认",
"dateStr": "2018-03-14"
},
......
],
.......
}
}