当前位置:网站首页>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
边栏推荐
- How does the nr-prach receiver detect the relationship between prembleid and Ta
- Project cost management__ Plan value_ Earned value_ Relationship among actual cost and Countermeasures
- STM32 serial port usart1 routine
- Sending and interrupt receiving of STM32 serial port
- yocto 技术分享第四期:自定义增加软件包支持
- 当你需要使用STM32某些功能,而51实现不了时, 那32自然不需要学
- Assignment to '*' form incompatible pointer type 'linkstack' {aka '*'} problem solving
- Nr--- Pusch I: sorting out the agreement process
- Gpiof6, 7, 8 configuration
- 一个可执行的二进制文件包含的不仅仅是机器指令
猜你喜欢

Definition and use of enum in C language

Nr--- Pusch I: sorting out the agreement process

How does the memory database give full play to the advantages of memory?

【男保姆式】教你打开第一个微信小程序
![【顺利毕业】[1]-游览 [学生管理信息系统]](/img/91/72cdea3eb3f61315595330d2c9016d.png)
【顺利毕业】[1]-游览 [学生管理信息系统]

Matlab reads hexadecimal numbers and converts them into signed short

Schematic diagram and connection method of six pin self-locking switch

单片机职业发展:能做下去的都成牛人了,熬不动就辞职或者改行了

An executable binary file contains more than machine instructions

没有多少人能够最终把自己的兴趣带到大学毕业上
随机推荐
2021-01-03
STM32 interrupt switch
Liquid crystal display
MySQL 数据库基础知识(系统化一篇入门)
A lottery like scissors, stone and cloth (C language)
Oracle数据库 SQL语句执行计划、语句跟踪与优化实例
【順利畢業】[1]-遊覽 [學生管理信息系統]
When you need to use some functions of STM32, but 51 can't realize them, 32 naturally doesn't need to learn
嵌入式系统没有特别明确的定义
Embedded systems are inherently flawed. Compared with the Internet, there are so many holes that it is simply difficult to walk away from
Of course, the most widely used 8-bit single chip microcomputer is also the single chip microcomputer that beginners are most easy to learn
Project cost management__ Topic of comprehensive calculation
SSB Introduction (PbCH and DMRs need to be supplemented)
There is no specific definition of embedded system
端午节快乐!—— canvas写的粽子~~~~~
openEuler kernel 技术分享 - 第1期 - kdump 基本原理、使用及案例介绍
Quelle langue choisir pour programmer un micro - ordinateur à puce unique
Seven sorting of ten thousand words by hand (code + dynamic diagram demonstration)
Which language should I choose to program for single chip microcomputer
MySQL的简单使用(增删改查)