根据接口返回的数据结构:建实体类去接受
根据数据返回的最外层是{ }还是[],如果是大括号用对象去接受,getObject.如果是中括号,则用List集合去接受。
例如:
返回的数据是一个集合:
{
"data": [
{
"address": "广东茂名电白县",
"categoryName": "有机肥",
"isHonesty": 1,
"isRealName": 2,
"picPath": "http://www.tsxn360.com/uploadFiles/20160904/e0250043fe044a668941796e2e4bd937-marklogo.jpg",
"priceUnit": "元/吨",
"productTitle": "",
"publishUserName": "罗兰旭",
"showPrice": "¥1500~2500",
"specInfo": "规格:不限",
"supplyId": "472049e788ec4c718e9d26ad0a354f07",
"timeStr": "1月前"
},
{
"address": "甘肃陇南徽县",
"categoryName": "百花蜜",
"isHonesty": 1,
"isRealName": 2,
"picPath": "http://www.tsxn360.com/uploadFiles/20160912/c890be981e9c496ab4e2698763da0aae-marklogo.jpg",
"priceUnit": "元/斤",
"productTitle": "深山百花蜜",
"publishUserName": "韩峥伟",
"showPrice": "¥85~95",
"specInfo": "波美度:41 纯度:纯度:100% 包装规格:1斤",
"supplyId": "6114e5638382497fab61dc9cf5b705cc",
"timeStr": "1月前"
}
],
"msg": "",
"status": 1
}
List<AdviceBean>mDatas;
mDatas = FJson.getObjects(result.getData().toString(), AdviceBean.class);
返回的数据是一个对象:
{
"dataList": [
{
"sellerId": "105665311973",
"grandTotal": "0.01",
"timeNum": "2016-10-24 22:12:22",
"realName": "哈哈",
"ISHONESTY": 1,
"logisticsCost": "0.00",
"saleUserIshonesty": 1,
"deliveryAddress": "河北石家庄长安区UK",
"buyerId": "101208908715",
"payState": 2,
"unpayTime": "2016-10-25 08:42:07",
"saleUserIsrealname": 1,
"co": "北京北京东城区",
"subtotal": "0.01",
"priceUnit": "元/斤",
"supplyId": "3505567d827144538bcc574919c3a72d",
"logisticsType": 2,
"qtyUnit": "斤",
"checkType": "2",
"supplyAddressId": "246984b92e0341558d7e512502cccfd0",
"buyUserIshonesty": 1,
"buyUserEvalCnt": "0",
"saleUserName": "哈哈",
"orderQty": 1,
"categoryId": "",
"orderId": "83bec301d531487f8d47022e864d43b9",
"addressId": "6757a3ff62aa421cb495f9827a255ad2",
"supplyAddress": "北京东城区hahaha",
"buyUserName": "小航",
"crtTime": "2016-10-24 22:12",
"spec": "平均单串重量:0.6~0.8斤",
"timeOut": "剩余9天",
"orderNo": "31201610242212228342",
"sellUserEvalCnt": "0",
"ISREALNAME": 1,
"buyUserIsrealname": 1,
"orderState": 60,
"orderType": 1,
"labourCosts": "0.00",
"categoryName": "青提",
"unitPrice": 0.01,
"supplyPic": "http://test.tsxn360.com/uploadFiles/20161021/9530a9e711e744f297d30474ad877138-marklogo.jpeg"
},
],
"dataCnt": 13,
"typeList": [],
"dataInfo": 0,
"bankCnt": 0
}
OrderListBean order = FJson.getObject(result.getData()
.toString(), OrderListBean.class);