Comments (9)
循环引用和重复引用这两个目前没有区别对待的,而且还没有方案
from fastjson.
我有一个方案,不需要改动很多代码,直接使用现有的 SerialContext ,判断是否递归引用时只要递归检查parent 里面的 object 是否是本身;
上述方案我已有实现,但是不知道是不是我代码没看透,貌似 ListSerializer 里 85、86两行代码是多余的(会导致多出一个层级关系)
itemSerializer = serializer.getObjectWriter(item.getClass());
//SerialContext itemContext = new SerialContext(context, object, fieldName);
//serializer.setContext(itemContext);
itemSerializer.write(serializer, item, i, elementType);
from fastjson.
A -> B -> C -> B -> A这种如何检测?
from fastjson.
在这个分支中 write 第二个B 时,可以在 B 的 Context 的 parent 链中找到第一个B是等于本身的,这是就该输出为引用了。
你举得这个例子还会有一个
A -> B -> A 也是递归引用了
from fastjson.
A -> B -> C -> A这种呢?
from fastjson.
A -> B -> C -> A 这种情况 write 第二个 A 时输出为引用;
我已通过邮件发了部分修改过的代码到你的邮箱
from fastjson.
你可以通过github的pull request提交patch么?
from fastjson.
由于新开了issue,旧这个关闭。
from fastjson.
soga.源码看不太懂. 原来是用DisableCircularReferenceDetect 来解决.
from fastjson.
Related Issues (20)
- Map类型反序列化时默认是解析成JSONObject类型 HOT 1
- FastJsonHttpMessageConverter中怎么取消了setParserConfig的API
- 一个对象多个Map属性赋值同一个map对象时无法正常反序列化 HOT 1
- Caused by: com.alibaba.fastjson.JSONException: TODO, offset 1, character
- $ref 反序列化不能反序列为引用对应的对象
- Android中序列化Context、Activity、Fragment导致StackOverflowError
- com.alibaba.fastjson.JSONException: GC overhead limit exceeded
- With IgnoreErrorGetter & WriteClassName to serialize , the value of number (short、double) with precision letter
- FastJson 1.2.83存在未在黑名单内的JDK原生可利用类
- 日期少0反序列化报错 HOT 1
- 使用线程池序列化时,有概率会出现ref循环引用问题 HOT 1
- 对UTC时间,非三位小数点的毫秒解析错误
- 重复了 关
- 有关fastjson设计上的问题
- 高版本反序列化时不能识别字段名
- 使用 graalvm 构建可执行文件,执行后发生: No classes have been predefined during the image build to load from bytecodes at runtime.
- jdk 11 fastjson 1.2.83 报 java.net.http does not export jdk.internal.net.http to unnamed module @0x67ecfe55
- ObjectSerializer元数据空间溢出。只有一个SerializeConfig实例 HOT 2
- fastjson 版本支持问题
- FastJsonHttpMessageConverter自定义 Long类型的Deserializer不生效 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastjson.