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();
这样写就不报错了

猜你喜欢

转载自www.cnblogs.com/dongyaotou/p/13180375.html