JsonToBean

result = defindPost.myDefinedPost(chatRecordsUrl, rwcr);
   
   Map classMap = new HashMap();
   classMap.put("recordlist",Records.class);   //需要定义参数映射到哪个类里头去
   
   CsvRecordResult crr= (CsvRecordResult) JSONObject.toBean(result, CsvRecordResult.class,classMap);
   List<Records> recordlist = crr.getRecordlist();
   for(Records s:recordlist) {
    
    System.out.println(s.toString());
   }




@JsonIgnoreProperties(ignoreUnknown = true)
public class SendTemplateMessageResult {
 @JsonProperty
 private int errcode;
 @JsonProperty
 private String errmsg;
 @JsonProperty
 private String msgid;
 public int getErrcode() {
  return errcode;
 }
 public void setErrcode(int errcode) {
  this.errcode = errcode;
 }
 public String getErrmsg() {
  return errmsg;
 }
 public void setErrmsg(String errmsg) {
  this.errmsg = errmsg;
 }
 public String getMsgid() {
  return msgid;
 }
 public void setMsgid(String msgid) {
  this.msgid = msgid;
 }
 public SendTemplateMessageResult(int errcode, String errmsg, String msgid) {
  super();
  this.errcode = errcode;
  this.errmsg = errmsg;
  this.msgid = msgid;
 }
 public SendTemplateMessageResult() {
  super();
 }
 }




猜你喜欢

转载自blog.csdn.net/qq_27988103/article/details/80165409