【发布时间】:2019-11-05 03:18:04
【问题描述】:
My API 的响应如下。
{
"status": true,
"message": "",
"data": {
"property_data": [
{
"iPropertyID": "179",
"sImage": "http://192.168.1.100:8080/protechdna/img/property/180219045755Etim%25web.jpg",
"isImageUploaded": true,
"sTypeOfPropertyMarked": "Sound System",
"sModel": "201",
"sMake": "sony",
"sSerialNumber": "12456789",
"sApproxValue": "149",
"sDescriptionOfProperty": "Description Of Property Description Of Property",
"sUniqueidentifyingFeatures": "Unique identifying features Unique identifying features Unique identifying features",
"room_detail": {
"iRoomID": "242",
"sRoomName": "romania"
},
"pin_detail": {
"iPinID": "788",
"sPin": "12345",
"kit_detail": {
"iKitID": "6",
"sTypeOfKit": "DNA Spray"
}
},
"owner_detail": {
"iUserID": "702",
"sEmailID": "priyank.nyusoft@gmail.com",
"full_name": "priyank Patel",
"address_line": "Main street",
"sPhone": "(999) 999-9999",
"state_detail": {
"iStateID": "41",
"sStateName": "Ohio"
},
"county_detail": {
"iCountyID": "2117",
"sCountyName": "Portage"
},
"city_detail": {
"iCityID": "20241",
"sCityName": "Newton Falls"
},
"zipcode_detail": {
"iZipCodeID": "18762",
"sZipcode": "44444"
}
}
}
],
"bicycle_data": [
{
"iBicycleID": "357",
"sImage": "http://192.168.1.100:8080/protechdna/img/property/220419021553101018213027hi%20res%20bike.jpg",
"isImageUploaded": true,
"sBicycleName": "catrike",
"sModel": "fgfdg",
"sMake": "dfgfg",
"sSerialNumber": "gfhfghtgf",
"sApproxValue": "456",
"sBicycleColor": "gff",
"sUniqueidentifyingFeatures": "fghfh",
"bicycletype_detail": {
"iBicycleTypeID": "3",
"sTypeName": "Touring Bikes"
},
"pin_detail": {
"iPinID": "788",
"sPin": "12345",
"kit_detail": {
"iKitID": "6",
"sTypeOfKit": "DNA Spray"
}
},
"owner_detail": {
"sEmailID": "bharat.nyusoft@gmail.com",
"full_name": "golden bicycle New",
"address_line": "t",
"iUserID": "",
"sPhone": "",
"state_detail": {
"iStateID": "12",
"sStateName": "Florida"
},
"county_detail": {
"iCountyID": "357",
"sCountyName": "Leon"
},
"city_detail": {
"iCityID": "3900",
"sCityName": "Tallahassee"
},
"zipcode_detail": {
"iZipCodeID": "13609",
"sZipcode": "32312"
}
}
},
{
"iBicycleID": "356",
"sImage": "http://192.168.1.100:8080/protechdna/img/property/020419084735041018112608hi%20res%20bike.jpg",
"isImageUploaded": true,
"sBicycleName": "catrike",
"sModel": "erer 123",
"sMake": "df",
"sSerialNumber": "12456789012",
"sApproxValue": "10",
"sBicycleColor": "erer",
"sUniqueidentifyingFeatures": "erer",
"bicycletype_detail": {
"iBicycleTypeID": "2",
"sTypeName": "Cyclocross Bikes"
},
"pin_detail": {
"iPinID": "788",
"sPin": "12345",
"kit_detail": {
"iKitID": "6",
"sTypeOfKit": "DNA Spray"
}
},
"owner_detail": {
"iUserID": "600",
"sEmailID": "das@gmail.com",
"full_name": "Das Patel",
"address_line": "",
"sPhone": "(123) 777-7007",
"state_detail": null,
"county_detail": null,
"city_detail": null,
"zipcode_detail": null
}
}
],
"vehicle_data": [
],
"accessory_data": [
]
}
}
在最后一个数组中,您可以看到车辆数据和附件数据中没有数据并显示括号 当 API 返回这种响应时,改造响应将在 onfailure 中代替 onResponse。 任何人都可以帮助我吗? 这是一个第 3 方 API,我无法修改来自服务器端的响应。
【问题讨论】:
-
pojo 本身一定有问题。你能在这里添加你的 pojo/model 类吗?
-
下面是模型/pojo类的链接..drive.google.com/open?id=1GOGMsy09-Sdf6tKOpAJbGs7B_auBmFck
-
@Napolean 感谢您的支持,当我检查具有数据和空白数组的结果时发现当我获取数据时他们正在发送 JSON 对象,而当没有数据时他们正在发送 JSON 数组这就是为什么 Model 类没有解析它,结果是失败而不是成功。