当前位置:网站首页>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
边栏推荐
- 新系列单片机还延续了STM32产品家族的低电压和节能两大优势
- For new students, if you have no contact with single-chip microcomputer, it is recommended to get started with 51 single-chip microcomputer
- Uniapp realizes global sharing of wechat applet and custom sharing button style
- 要選擇那種語言為單片機編寫程序呢
- el-table X轴方向(横向)滚动条默认滑到右边
- Idea remote breakpoint debugging jar package project
- Eight working modes of stm32gpio and chip naming rules
- 【男保姆式】教你打开第一个微信小程序
- Simple use of MySQL (addition, deletion, modification and query)
- STM32 running lantern experiment - library function version
猜你喜欢
STM32 interrupt switch
Which language should I choose to program for single chip microcomputer
Working mode of 80C51 Serial Port
In third tier cities and counties, it is difficult to get 10K after graduation
应用最广泛的8位单片机当然也是初学者们最容易上手学习的单片机
Successful graduation [3]- blog system update...
Nr-prach:prach format and time-frequency domain
How does the memory database give full play to the advantages of memory?
Pymssql controls SQL for Chinese queries
Quelle langue choisir pour programmer un micro - ordinateur à puce unique
随机推荐
Raspberry pie installation SciPy
Project cost management__ Cost management technology__ Article 8 performance review
Chromium Embedded Framework (CEF) 介绍
CEF download, compile project
UCI and data multiplexing are transmitted on Pusch - Part I
一个可执行的二进制文件包含的不仅仅是机器指令
【力扣刷题笔记(二)】特别技巧,模块突破,45道经典题目分类总结,在不断巩固中精进
03 FastJson 解决循环引用
2021-10-27
Successful graduation [2] - student health management system function development...
Mobile phones are a kind of MCU, but the hardware it uses is not 51 chip
Happy Dragon Boat Festival—— Zongzi written by canvas~~~~~
JS基础-原型原型链和宏任务/微任务/事件机制
STM32 serial communication principle
[22 graduation season] I'm a graduate yo~
C language enumeration type
我想各位朋友都应该知道学习的基本规律就是:从易到难
I think all friends should know that the basic law of learning is: from easy to difficult
[graduation successful] [1] - tour [Student Management Information System]
Stm32-hal library learning, using cubemx to generate program framework