应该是这么个形式
{
"collectionDtoList":[{
"collectionType":1,"typeId":3}]}
使用javabean进行解析对应
import java.util.List;
public class CancelCollectBean {
private List<CollectionDtoListDTO> collectionDtoList;
public List<CollectionDtoListDTO> getCollectionDtoList() {
return collectionDtoList;
}
public void setCollectionDtoList(List<CollectionDtoListDTO> collectionDtoList) {
this.collectionDtoList = collectionDtoList;
}
public static class CollectionDtoListDTO {
private int collectionType;
private int typeId;
public int getCollectionType() {
return collectionType;
}
public void setCollectionType(int collectionType) {
this.collectionType = collectionType;
}
public int getTypeId() {
return typeId;
}
public void setTypeId(int typeId) {
this.typeId = typeId;
}
}
}
参数组装
List<CancelCollectBean.CollectionDtoListDTO> collectionDtoList = new ArrayList<>();
CancelCollectBean.CollectionDtoListDTO collectionDtoListDTO = new CancelCollectBean.CollectionDtoListDTO();
collectionDtoListDTO.setCollectionType(1);
Log.e("wy", "156onItemClick: "+records.get(position).getTypeId() );
collectionDtoListDTO.setTypeId(records.get(position).getTypeId());
collectionDtoList.add(collectionDtoListDTO);