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
key为map类型的字符串fastjson2兼容版无法解析
{ "k1":{ "k2":[ { {} : {} } ] } }
String json = "{\n" + " \"k1\":{\n" + " \"k2\":[\n" + " {\n" + " {} : {}\n" + " }\n" + " ]\n" + " }\n" + "}"; JSONObject jsonObject = JSON.parseObject(json);
fastjson1不报错,fastjson2兼容版本报错
java.lang.ClassCastException: class com.alibaba.fastjson.JSONObject cannot be cast to class java.lang.String (com.alibaba.fastjson.JSONObject is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap') at com.alibaba.fastjson.JSONObject.put(JSONObject.java:49) at com.alibaba.fastjson2.JSONReader.readObject(JSONReader.java:2354) at com.alibaba.fastjson2.JSONReader.readArray(JSONReader.java:2579) at com.alibaba.fastjson2.JSONReader.readObject(JSONReader.java:2308) at com.alibaba.fastjson2.JSONReader.read(JSONReader.java:2108) at com.alibaba.fastjson.JSON.parseObject(JSON.java:189)
两者表现相同
请复制并粘贴任何相关的日志输出。
如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
问题描述
key为map类型的字符串fastjson2兼容版无法解析
环境信息
重现步骤
fastjson1不报错,fastjson2兼容版本报错
期待的正确结果
两者表现相同
相关日志输出
请复制并粘贴任何相关的日志输出。
附加信息
如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。
The text was updated successfully, but these errors were encountered: