{
"serviceInfoDtoList": [
{
"vesselName": null,
"imoNo": null,
"requireDate": null,
"inPortDays": 1,
"inPortHours": 2,
"urgency": 0,
"serviceSite": "3",
"serviceItemDtoList": [
{
"serviceName": "测试一级专家分类",
"serviceClassId": 652,
"deviceMaker": "设备厂家",
"deviceModel": "设备型号",
"appId": 8
},
{
"serviceName": "测试二级专家分类",
"serviceClassId": 653,
"deviceMaker": "设备厂家2",
"deviceModel": "设备型号3",
"appId": 8
}
],
"serviceInfo": null,
"buyerName": "4",
"buyerPhone": "5",
"remark": null,
"fileUrlList": []
}
]
}
哎呀怎么解析呢?别着急,跟解析响应一个道理
使用xutils3进行参数组装时比较特殊的一点:
params.addBodyParameter("", o.toString());
全代码
DemandRequireBean.ServiceInfoDtoListDTO serviceInfoDtoListDTO = new DemandRequireBean.ServiceInfoDtoListDTO();
serviceInfoDtoListDTO.setInPortDays(1);
serviceInfoDtoListDTO.setInPortHours(2);
serviceInfoDtoListDTO.setServiceSite("港口");
serviceInfoDtoListDTO.setBuyerName("联系人");
serviceInfoDtoListDTO.setBuyerPhone("电话");
List<DemandRequireBean.ServiceInfoDtoListDTO.ServiceItemDtoListDTO> serviceItemDtoList = new ArrayList<>();
DemandRequireBean.ServiceInfoDtoListDTO.ServiceItemDtoListDTO serviceItemDtoListDTO = new DemandRequireBean.ServiceInfoDtoListDTO.ServiceItemDtoListDTO();
serviceItemDtoListDTO.setServiceName("一级专家");
serviceItemDtoListDTO.setDeviceMaker("设备厂家");
serviceItemDtoListDTO.setDeviceModel("设备型号");
serviceItemDtoList.add(serviceItemDtoListDTO);
serviceInfoDtoListDTO.setServiceItemDtoList(serviceItemDtoList);
Object o = JSON.toJSON(serviceInfoDtoListDTO);
RequestParams params = new RequestParams(Constant.inquiry);
params.addHeader("Authorization", Constant.authorization);
params.addHeader("language", "zh_CN");
params.setMultipart(true);
params.setAsJsonContent(true);
params.addBodyParameter("", o.toString());