You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
nuoqin
changed the title
[QUESTION] 关于1.x和2.x com.alibaba.fastjson2.JSONArray cannot be cast to com.alibaba.fastjson.JSONArray
[QUESTION] 2.x com.alibaba.fastjson2.JSONArray cannot be cast to com.alibaba.fastjson.JSONArray
Jun 2, 2022
为什么在fastjson2这里不采用原先的jsonArray呢?
1.x中 使用类型转换
JSONObject fileJson = JSON.parseObject(jsonStr); JSONArray files = (JSONArray) fileJson.get("files");
更换成2.x后使用上面的代码会出现com.alibaba.fastjson2.JSONArray cannot be cast to com.alibaba.fastjson.JSONArray
是因为格式化代码中的JSONArray 被替换成了com.alibaba.fastjson2.JSONArray。可以再com.alibaba.fastjson2.reader.ObjectReaderImplMap中488行 JSONArray list = new JSONArray();
The text was updated successfully, but these errors were encountered: