当前位置:网站首页>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
边栏推荐
- Getting started with JMX, MBean, mxbean, mbeanserver
- 新系列单片机还延续了STM32产品家族的低电压和节能两大优势
- For new students, if you have no contact with single-chip microcomputer, it is recommended to get started with 51 single-chip microcomputer
- Comment la base de données mémoire joue - t - elle l'avantage de la mémoire?
- 自动装箱与拆箱了解吗?原理是什么?
- [CSDN] C1 training problem analysis_ Part II_ Web Foundation
- UCI and data multiplexing are transmitted on Pusch - determine the bit number of harqack, csi1 and csi2 (Part II)
- Mobile phones are a kind of MCU, but the hardware it uses is not 51 chip
- 01仿B站项目业务架构
- (1) 什么是Lambda表达式
猜你喜欢

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

el-table X轴方向(横向)滚动条默认滑到右边
![[CSDN] C1 training problem analysis_ Part II_ Web Foundation](/img/91/72cdea3eb3f61315595330d2c9016d.png)
[CSDN] C1 training problem analysis_ Part II_ Web Foundation

STM32 serial port usart1 routine

How does the nr-prach receiver detect the relationship between prembleid and Ta

There is no specific definition of embedded system

03 FastJson 解决循环引用

UCI and data multiplexing are transmitted on Pusch - determine the bit number of harqack, csi1 and csi2 (Part II)

STM32 interrupt priority management

Assignment to '*' form incompatible pointer type 'linkstack' {aka '*'} problem solving
随机推荐
Blue Bridge Cup for migrant workers majoring in electronic information engineering
Code word in NR
Uniapp realizes global sharing of wechat applet and custom sharing button style
Application of external interrupts
Successful graduation [3]- blog system update...
The cyclic shift of PUCCH in NR channel is generated by MATLAB
Happy Dragon Boat Festival—— Zongzi written by canvas~~~~~
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
Project cost management__ Plan value_ Earned value_ Relationship among actual cost and Countermeasures
Basic knowledge of MySQL database (an introduction to systematization)
当你需要使用STM32某些功能,而51实现不了时, 那32自然不需要学
Runtime. getRuntime(). GC () and runtime getRuntime(). The difference between runfinalization()
Successful graduation [2] - student health management system function development...
Drive and control program of Dianchuan charging board for charging pile design
(1) 什么是Lambda表达式
Hal library sets STM32 clock
Project cost management__ Cost management technology__ Article 6 prediction
2021-10-27
I think all friends should know that the basic law of learning is: from easy to difficult
Which language should I choose to program for single chip microcomputer