We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
问题描述 使用 fastjson1 的 JSON.toJSON() 方法,转换后的数据中存在 com.alibaba.fastjson2.JSONObject 对象。
环境信息 请填写以下信息:
OS信息:Windows 10 JDK信息:JDK信息:Oracle Java 1.8.0_381 版本信息:Fastjson2 2.0.53 重现步骤 如何操作可以重现该问题:
抛出异常,见日志输出。 `
Map map1 = new HashMap(); List list1 = new LinkedList(); map1.put("list1", list1); Map map2 = new HashMap(); list1.add(map2); map2.put("id", "123"); map2.put("name", "张三"); JSONObject o1 = (JSONObject)JSON.toJSON(map1); JSONArray jsonArray = (JSONArray) o1.get("list1"); for (Object subJsonObject : jsonArray) { JSONObject jsonObject = (JSONObject) subJsonObject; }
` 期待的正确结果 使用 fastjson1 兼容 api 时,返回 fastjson1 的 JSONObject 。
相关日志输出 Exception in thread "main" java.lang.ClassCastException: com.alibaba.fastjson2.JSONObject cannot be cast to com.alibaba.fastjson.JSONObject
The text was updated successfully, but these errors were encountered:
No branches or pull requests
问题描述
使用 fastjson1 的 JSON.toJSON() 方法,转换后的数据中存在 com.alibaba.fastjson2.JSONObject 对象。
环境信息
请填写以下信息:
OS信息:Windows 10
JDK信息:JDK信息:Oracle Java 1.8.0_381
版本信息:Fastjson2 2.0.53
重现步骤
如何操作可以重现该问题:
抛出异常,见日志输出。
`
`
期待的正确结果
使用 fastjson1 兼容 api 时,返回 fastjson1 的 JSONObject 。
相关日志输出
Exception in thread "main" java.lang.ClassCastException: com.alibaba.fastjson2.JSONObject cannot be cast to com.alibaba.fastjson.JSONObject
The text was updated successfully, but these errors were encountered: