当前位置:网站首页>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
边栏推荐
- Assignment to '*' form incompatible pointer type 'linkstack' {aka '*'} problem solving
- [successful graduation] [1] - visit [student management information system]
- When you need to use some functions of STM32, but 51 can't realize them, 32 naturally doesn't need to learn
- 新系列单片机还延续了STM32产品家族的低电压和节能两大优势
- How does the memory database give full play to the advantages of memory?
- 要選擇那種語言為單片機編寫程序呢
- NR technology -- MIMO
- Raspberry pie installation SciPy
- openEuler kernel 技术分享 - 第1期 - kdump 基本原理、使用及案例介绍
- PIP references domestic sources
猜你喜欢
Code word in NR
Uniapp realizes global sharing of wechat applet and custom sharing button style
Gpiof6, 7, 8 configuration
Nr--- Pusch I: sorting out the agreement process
How does the nr-prach receiver detect the relationship between prembleid and Ta
SCM is now overwhelming, a wide variety, so that developers are overwhelmed
端午节快乐!—— canvas写的粽子~~~~~
学习开发没有捷径,也几乎不存在带路会学的快一些的情况
Idea remote breakpoint debugging jar package project
Basic knowledge of communication interface
随机推荐
JS基础-原型原型链和宏任务/微任务/事件机制
[CSDN] C1 training problem analysis_ Part IV_ Advanced web
Serial port programming
Liquid crystal display
Project scope management__ Scope management plan and scope specification
Successful graduation [2] - student health management system function development...
【顺利毕业】[1]-游览 [学生管理信息系统]
Project cost management__ Topic of comprehensive calculation
Runtime. getRuntime(). GC () and runtime getRuntime(). The difference between runfinalization()
Working mode of 80C51 Serial Port
Notes on C language learning of migrant workers majoring in electronic information engineering
All processes of top ten management in project management
2020-08-23
Nr-prach:prach format and time-frequency domain
内存数据库究竟是如何发挥内存优势的?
在三线城市、在县城,很难毕业就拿到10K
Gpiof6, 7, 8 configuration
2021-10-27
IDEA远程断点调试jar包项目
Characteristics of PUCCH formats