当前位置:网站首页>03 fastjason solves circular references
03 fastjason solves circular references
2022-07-03 09:59:00 【look-word】
FastJson Solve circular references
The reasons causing In the object to be converted There are two references with the same address
Code display :
public static void main(String[] args) {
ArrayList<Object> list = new ArrayList<>();
Object o = new Object();
list.add(o);
list.add(o);
// Output length
System.out.println(list.size());
// convert to json Result of character
System.out.println(JSONObject.toJSONString(list));
}

The results show that , Converted json String is not what we want , The general reason for the problem is fastjson During the conversion , It is found that there is already a reference to this location , So the later one points to the previous reference , So how to solve this problem ?
// Solve circular references
System.out.println(JSONObject.toJSONString(list,SerializerFeature.DisableCircularReferenceDetect));

You can see Now we have successfully solved the problem of circular reference
边栏推荐
- Project cost management__ Plan value_ Earned value_ Relationship among actual cost and Countermeasures
- UCI and data multiplexing are transmitted on Pusch (Part V) -- polar coding
- UCI and data multiplexing are transmitted on Pusch (Part VI) -- LDPC coding
- uniapp 实现微信小程序全局分享及自定义分享按钮样式
- The third paper of information system project manager in soft examination
- Learn the contents of 5g toolbox supporting NR through the NR resources provided by MATLAB
- UCI and data multiplexing are transmitted on Pusch (Part 4) --small block lengths
- Timer and counter of 51 single chip microcomputer
- 没有多少人能够最终把自己的兴趣带到大学毕业上
- Application of 51 single chip microcomputer timer
猜你喜欢

Oracle数据库 SQL语句执行计划、语句跟踪与优化实例

STM32 interrupt switch

SCM is now overwhelming, a wide variety, so that developers are overwhelmed

How does the nr-prach receiver detect the relationship between prembleid and Ta

单片机学到什么程度能找到工作,这个标准不好量化

JS foundation - prototype prototype chain and macro task / micro task / event mechanism

Not many people can finally bring their interests to college graduation
![[Li Kou brush question notes (II)] special skills, module breakthroughs, classification and summary of 45 classic questions, and refinement in continuous consolidation](/img/06/7fd985faf8806ceface3864d4b3180.png)
[Li Kou brush question notes (II)] special skills, module breakthroughs, classification and summary of 45 classic questions, and refinement in continuous consolidation
![[22 graduation season] I'm a graduate yo~](/img/e2/5393b051e2d1cb4c307efdfb3f9148.png)
[22 graduation season] I'm a graduate yo~

Comment la base de données mémoire joue - t - elle l'avantage de la mémoire?
随机推荐
There is no specific definition of embedded system
2.Elment Ui 日期选择器 格式化问题
JS基础-原型原型链和宏任务/微任务/事件机制
内存数据库究竟是如何发挥内存优势的?
干单片机这一行的时候根本没想过这么多,只想着先挣钱养活自己
没有多少人能够最终把自己的兴趣带到大学毕业上
STM32 general timer 1s delay to realize LED flashing
NR PUCCH format0 sequence generation and detection mechanism
MySQL 数据库基础知识(系统化一篇入门)
NR technology -- MIMO
Characteristics of PUCCH formats
ADS simulation design of class AB RF power amplifier
要選擇那種語言為單片機編寫程序呢
SCM career development: those who can continue to do it have become great people. If they can't endure it, they will resign or change their careers
Code word in NR
Successful graduation [2] - student health management system function development...
Synchronization control between tasks
Emballage automatique et déballage compris? Quel est le principe?
Nr-prach: access scenario and access process
我想各位朋友都应该知道学习的基本规律就是:从易到难