Caused by: java.lang.ClassCastException: com.alibaba.fastjson.JSONObject cannot be cast to com.picchealth.hmbms.payment.pojo.Settle

json对象的转换问题:

  Object aa = map.get("settleList");
// for (int i = 0; i < settleList.size(); i++) {
// Settle settle = settleList.get(i);
// System.out.println(settle);
// }

String result=JSON.toJSONString(aa);
// List<Settle> settleList = (List<Settle>) JSONArray.(jsonObjString, Settle.class);
List<Settle> settles = JSONArray.parseArray(result, Settle.class);
settles.get(1).getBatchNo();
这样写就不报错了

posted on 2020-06-23 09:30  ~码铃薯~  阅读(3016)  评论(0编辑  收藏  举报

导航