当前位置:网站首页>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产品家族的低电压和节能两大优势
- 【顺利毕业】[1]-游览 [学生管理信息系统]
- Fundamentals of Electronic Technology (III)__ Chapter 6 combinational logic circuit
- 嵌入式本来就很坑,相对于互联网来说那个坑多得简直是难走
- Project cost management__ Cost management technology__ Article 6 prediction
- 对于新入行的同学,如果你完全没有接触单片机,建议51单片机入门
- Uniapp realizes global sharing of wechat applet and custom sharing button style
- UCI and data multiplexing are transmitted on Pusch - placement of data and UCI positions (Part III)
- Project cost management__ Topic of comprehensive calculation
- 我想各位朋友都应该知道学习的基本规律就是:从易到难
猜你喜欢
For new students, if you have no contact with single-chip microcomputer, it is recommended to get started with 51 single-chip microcomputer
el-table X轴方向(横向)滚动条默认滑到右边
当你需要使用STM32某些功能,而51实现不了时, 那32自然不需要学
openEuler kernel 技术分享 - 第1期 - kdump 基本原理、使用及案例介绍
Definition and use of enum in C language
03 FastJson 解决循环引用
PRACH --- originator
Basic knowledge of communication interface
万字手撕七大排序(代码+动图演示)
GPIO port details, Hal library operation keys
随机推荐
学习开发没有捷径,也几乎不存在带路会学的快一些的情况
It is difficult to quantify the extent to which a single-chip computer can find a job
[CSDN] C1 training problem analysis_ Part IV_ Advanced web
For new students, if you have no contact with single-chip microcomputer, it is recommended to get started with 51 single-chip microcomputer
Design of charging pile mqtt transplantation based on 4G EC20 module
2020-08-23
Quelle langue choisir pour programmer un micro - ordinateur à puce unique
CEF下载,编译工程
Stm32f04 clock configuration
Raspberry pie installation SciPy
內存數據庫究竟是如何發揮內存優勢的?
Project cost management__ Cost management technology__ Article 7 completion performance index (tcpi)
Idea remote breakpoint debugging jar package project
UCI and data multiplexing are transmitted on Pusch (Part VI) -- LDPC coding
SSB Introduction (PbCH and DMRs need to be supplemented)
ADS simulation design of class AB RF power amplifier
The cyclic shift of PUCCH in NR channel is generated by MATLAB
Fundamentals of Electronic Technology (III)__ Chapter 6 combinational logic circuit
IDEA远程断点调试jar包项目
In third tier cities and counties, it is difficult to get 10K after graduation