当前位置:网站首页>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
边栏推荐
- Runtime. getRuntime(). GC () and runtime getRuntime(). The difference between runfinalization()
- STM32 serial communication principle
- 嵌入式系统没有特别明确的定义
- All processes of top ten management in project management
- Mysql database underlying foundation column
- 51 MCU tmod and timer configuration
- Of course, the most widely used 8-bit single chip microcomputer is also the single chip microcomputer that beginners are most easy to learn
- el-table X轴方向(横向)滚动条默认滑到右边
- 我想各位朋友都应该知道学习的基本规律就是:从易到难
- 干单片机这一行的时候根本没想过这么多,只想着先挣钱养活自己
猜你喜欢

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

NR PUCCH format0 sequence generation and detection mechanism

Stm32-hal library learning, using cubemx to generate program framework
![[successful graduation] [1] - visit [student management information system]](/img/91/72cdea3eb3f61315595330d2c9016d.png)
[successful graduation] [1] - visit [student management information system]

Nr-prach:prach format and time-frequency domain

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

UCI and data multiplexing are transmitted on Pusch (Part VI) -- LDPC coding

el-table X轴方向(横向)滚动条默认滑到右边

当你需要使用STM32某些功能,而51实现不了时, 那32自然不需要学

Basic knowledge of communication interface
随机推荐
Fundamentals of Electronic Technology (III)_ Chapter 2 principle of amplification circuit__ Crystal triode and field effect triode
Uniapp realizes global sharing of wechat applet and custom sharing button style
Design of charging pile mqtt transplantation based on 4G EC20 module
SCM is now overwhelming, a wide variety, so that developers are overwhelmed
Synchronization control between tasks
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
Sending and interrupt receiving of STM32 serial port
Happy Dragon Boat Festival—— Zongzi written by canvas~~~~~
UCI and data multiplexing are transmitted on Pusch - determine the bit number of harqack, csi1 and csi2 (Part II)
GPIO port details, Hal library operation keys
It is difficult to quantify the extent to which a single-chip computer can find a job
openEuler kernel 技术分享 - 第1期 - kdump 基本原理、使用及案例介绍
Education is a pass and ticket. With it, you can step into a higher-level environment
The third paper of information system project manager in soft examination
2021-10-28
Qt QComboBox QSS样式设置
Assignment to '*' form incompatible pointer type 'linkstack' {aka '*'} problem solving
MySQL 数据库基础知识(系统化一篇入门)
嵌入式系统没有特别明确的定义
Runtime.getRuntime().gc() 和 Runtime.getRuntime().runFinalization() 的区别