Json 字符串如下:
{"data":[{"created":1603336724000,"updated":1603336724000,"id":"10785697","fromImageId":"0","fromCidId":"10785696","imageData":"http://44.80.20.118/download/image/2020/10/22/2020-10-22-11-18-44-074-3357.jpg","xm":"cenzhizhi","score":0.0,"type":4,"cid":null,"realName":"","gender":"","time":1603336724000,"age":"-1"}],"errCode":0,"maxPage":0,"total":1,"count":0}
对象如下
public class IntelliUserRespVo {
private List<IntellifUserAuthVo> data;
private Integer errCode;
private Integer maxPage;
private Integer total;
private Integer count;
public List<IntellifUserAuthVo> getData() {
return data;
}
public void setData(List<IntellifUserAuthVo> data) {
this.data = data;
}
...
public class IntellifUserAuthVo {
@ApiModelProperty("姓名")
private String xm;
@ApiModelProperty("照片地址 暂不可访问")
private String photo;
@ApiModelProperty("照片Base")
private String photoBase; // base64
@ApiModelProperty("cid")
private String fromCidId;
@ApiModelProperty("手机号码,可能存在多个")
private String sjhm;
@ApiModelProperty("联系地址")
private String dsmc;
@ApiModelProperty("身份证")
private String gmsfhm;
@ApiModelProperty("民族名称")
private String mzmc;
public String getXm() {
return xm;
}
public void setXm(String xm) {
this.xm = xm;
}
...
方法如下:
IntelliUserRespVo respVo = Json.fromJson(IntelliUserRespVo.class, httpResponse.body());
return respVo.getData().get(0).getFromCidId();
异常如下:
Exception in thread "main" java.lang.UnsupportedOperationException
at java.util.AbstractCollection.add(AbstractCollection.java:262)
at org.nutz.mapl.impl.convert.ObjConvertImpl.injectCollection(ObjConvertImpl.java:192)
at org.nutz.mapl.impl.convert.ObjConvertImpl.inject(ObjConvertImpl.java:85)
at org.nutz.mapl.impl.convert.ObjConvertImpl.convert(ObjConvertImpl.java:72)
at org.nutz.mapl.Mapl.maplistToObj(Mapl.java:34)
at org.nutz.mapl.impl.convert.ObjConvertImpl.injectObj(ObjConvertImpl.java:248)
at org.nutz.mapl.impl.convert.ObjConvertImpl.inject(ObjConvertImpl.java:91)
at org.nutz.mapl.impl.convert.ObjConvertImpl.convert(ObjConvertImpl.java:72)
at org.nutz.mapl.Mapl.maplistToObj(Mapl.java:34)
at org.nutz.json.Json.parse(Json.java:94)
at org.nutz.json.Json.fromJson(Json.java:73)
at org.nutz.json.Json.fromJson(Json.java:178)
请问这个怎么处理呀