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解析有重复引用对象的时候,会使用$ref来减少内容大小,由于下游系统使用的是fastjson1,上游系统使用的是fastjson2,fastjson2在解析fastjson1转换的字符串的时候会解析为null,造成业务系统报错
请填写以下信息:
public class TestFastJsonRef { public static void main(String[] args) { Test2 test21 = new Test2(); test21.value = "test21"; Test2 test22 = new Test2(); test22.value = "test22"; Test1 test1 = new Test1(); test1.test11 = test21; test1.test12 = new HashMap<>(2); test1.test12.put("test21", test21); test1.test13 = new HashMap<>(2); test1.test13.put("test22", test22); String fastJson1Str = com.alibaba.fastjson.JSON.toJSONString(test1); System.out.println("使用fastjson1转换重复引用字符串结果: " + fastJson1Str); Test1 fastJson1Parse = com.alibaba.fastjson.JSON.parseObject(fastJson1Str, Test1.class); System.out.println("使用fastjson1解析转换后的字符串结果: " + com.alibaba.fastjson2.JSON.toJSONString(fastJson1Parse)); Test1 fastJson2Parse = com.alibaba.fastjson2.JSON.parseObject(fastJson1Str, Test1.class); System.out.println("使用fastjson2解析转换后的字符串结果: " + com.alibaba.fastjson2.JSON.toJSONString(fastJson2Parse)); } @Data private static class Test1 { private Test2 test11; private Map<String, Test2> test12; private Map<String, Test2> test13; } @Data private static class Test2 { private String value; } }
fastjson2支持正确解析fastjson1转换的带$ref的字符串
The text was updated successfully, but these errors were encountered:
fix parse reference incorrect, for issue #2072
0f15b81
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.44-SNAPSHOT/ 问题重现并且修复,请帮忙用2.0.44-SNAPSHOT版本验证,2.0.44版本预计在2024年元旦发布
Sorry, something went wrong.
https://github.com/alibaba/fastjson2/releases/tag/2.0.44 请用新版本
No branches or pull requests
问题描述
在使用fastjson1解析有重复引用对象的时候,会使用$ref来减少内容大小,由于下游系统使用的是fastjson1,上游系统使用的是fastjson2,fastjson2在解析fastjson1转换的字符串的时候会解析为null,造成业务系统报错
环境信息
请填写以下信息:
重现步骤
期待的正确结果
fastjson2支持正确解析fastjson1转换的带$ref的字符串
相关日志输出
The text was updated successfully, but these errors were encountered: