java.lang.String cannot be cast to com.alibaba.fastjson.JSONObject解決辦法

hcmony發表於2017-10-20
java.lang.ClassCastException: java.lang.String cannot be cast to com.alibaba.fastjson.JSONObject

        at com.alibaba.fastjson.JSONObject.getJSONObject(JSONObject.java:109)


ResultModel<List<InfoWarn>> rs = JSON.parseObject(httpResult, ResultModel.class);

for (int j = 0; j < infoWarnList.size(); j++) {
   JSON json = (JSON) JSON.toJSON(infoWarnList.get(j));
   InfoWarn warn = JSON.toJavaObject(json,InfoWarn.class);}

相關文章