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
简要描述您碰到的问题。
请填写以下信息:
使用fastjson2反序列化对象,当对象持有自身this引用时,序列化的占位符是“..”,与fastjson1行为不兼容
{"id":"abc","self":{"$ref":".."}}
public class DN { private DN self; private String id; public DN getSelf() { return this.self; } public void setSelf(DN self) { this.self = self; } public String getId() { return id; } public void setId(String id) { this.id = id; } } @Test public void testFastjson2SelfRef(){ JSON.config(JSONWriter.Feature.ReferenceDetection,true); DN dn = new DN(); dn.setId("abc"); dn.setSelf(dn); String jsonString = JSON.toJSONString(dn); System.out.println(jsonString); // {"id":"abc","self":{"$ref":".."}} } @Test public void testFastjson1SelfRef(){ DN dn = new DN(); dn.setId("abc"); dn.setSelf(dn); String jsonString = com.alibaba.fastjson.JSON.toJSONString(dn); System.out.println(jsonString); // {"id":"abc","self":{"$ref":"@"}} }
序列化后自身引用使用@占位符 {"id":"abc","self":{"$ref":"@"}}
请复制并粘贴任何相关的日志输出。
如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。
The text was updated successfully, but these errors were encountered:
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson/2.0.54-SNAPSHOT/ 问题已修复,请帮忙用2.0.54-SNAPSHOT快照版本验证,2.0.54正式版本预计在月底发布
Sorry, something went wrong.
https://github.com/alibaba/fastjson2/releases/tag/2.0.54 问题已修复,请用新版本
No branches or pull requests
问题描述
简要描述您碰到的问题。
环境信息
请填写以下信息:
使用fastjson2反序列化对象,当对象持有自身this引用时,序列化的占位符是“..”,与fastjson1行为不兼容
{"id":"abc","self":{"$ref":".."}}
期待的正确结果
序列化后自身引用使用@占位符
{"id":"abc","self":{"$ref":"@"}}
相关日志输出
请复制并粘贴任何相关的日志输出。
附加信息
如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。
The text was updated successfully, but these errors were encountered: