当前位置:网站首页>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
边栏推荐
- Nr-prach:prach format and time-frequency domain
- Getting started with JMX, MBean, mxbean, mbeanserver
- Definition and use of enum in C language
- STM32 serial port usart1 routine
- [graduation successful] [1] - tour [Student Management Information System]
- Basic knowledge of MySQL database (an introduction to systematization)
- [untitled] proteus simulation of traffic lights based on 89C51 Single Chip Microcomputer
- UCI and data multiplexing are transmitted on Pusch - determine the bit number of harqack, csi1 and csi2 (Part II)
- 2020-08-23
- 干单片机这一行的时候根本没想过这么多,只想着先挣钱养活自己
猜你喜欢

There is no specific definition of embedded system

要选择那种语言为单片机编写程序呢

2.Elment Ui 日期选择器 格式化问题
![[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

Programming ideas are more important than anything, not more than who can use several functions, but more than the understanding of the program

没有多少人能够最终把自己的兴趣带到大学毕业上

Vector processor 9_ Basic multilevel interconnection network

NR technology -- MIMO

In third tier cities and counties, it is difficult to get 10K after graduation

STM32 external interrupt experiment
随机推荐
STM32 running lantern experiment - library function version
[graduation successful] [1] - tour [Student Management Information System]
Drive and control program of Dianchuan charging board for charging pile design
万字手撕七大排序(代码+动图演示)
01仿B站项目业务架构
Basic knowledge of MySQL database (an introduction to systematization)
Characteristics of PUCCH formats
Emballage automatique et déballage compris? Quel est le principe?
JS foundation - prototype prototype chain and macro task / micro task / event mechanism
学习开发没有捷径,也几乎不存在带路会学的快一些的情况
Stm32f04 clock configuration
Learn the contents of 5g toolbox supporting NR through the NR resources provided by MATLAB
编程思想比任何都重要,不是比谁多会用几个函数而是比程序的理解
我想各位朋友都应该知道学习的基本规律就是:从易到难
手机都算是单片机的一种,只不过它用的硬件不是51的芯片
How does the nr-prach receiver detect the relationship between prembleid and Ta
2020-08-23
Notes on C language learning of migrant workers majoring in electronic information engineering
自動裝箱與拆箱了解嗎?原理是什麼?
Oracle database SQL statement execution plan, statement tracking and optimization instance