当前位置:网站首页>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
边栏推荐
- 【男保姆式】教你打开第一个微信小程序
- [successful graduation] [1] - visit [student management information system]
- 2021-01-03
- MySQL 数据库基础知识(系统化一篇入门)
- 內存數據庫究竟是如何發揮內存優勢的?
- Notes on C language learning of migrant workers majoring in electronic information engineering
- Matlab reads hexadecimal numbers and converts them into signed short
- Happy Dragon Boat Festival—— Zongzi written by canvas~~~~~
- Programming ideas are more important than anything, not more than who can use several functions, but more than the understanding of the program
- Project cost management__ Topic of comprehensive calculation
猜你喜欢

Oracle database SQL statement execution plan, statement tracking and optimization instance
![Successful graduation [3]- blog system update...](/img/91/72cdea3eb3f61315595330d2c9016d.png)
Successful graduation [3]- blog system update...

应用最广泛的8位单片机当然也是初学者们最容易上手学习的单片机

Nr--- Pusch I: sorting out the agreement process

Nr-prach: access scenario and access process

I didn't think so much when I was in the field of single chip microcomputer. I just wanted to earn money to support myself first

Fundamentals of Electronic Technology (III)__ Chapter 1 resistance of parallel circuit

NR PUCCH format0 sequence generation and detection mechanism

要選擇那種語言為單片機編寫程序呢

学习开发没有捷径,也几乎不存在带路会学的快一些的情况
随机推荐
MYSQL数据库底层基础专栏
Raspberry pie installation SciPy
Application of external interrupts
How does the nr-prach receiver detect the relationship between prembleid and Ta
Timer and counter of 51 single chip microcomputer
Project scope management__ Scope management plan and scope specification
Embedded systems are inherently flawed. Compared with the Internet, there are so many holes that it is simply difficult to walk away from
Vector processor 9_ Basic multilevel interconnection network
STM32 general timer output PWM control steering gear
[successful graduation] [1] - visit [student management information system]
Oracle数据库 SQL语句执行计划、语句跟踪与优化实例
03 FastJson 解决循环引用
Stm32-hal library learning, using cubemx to generate program framework
(1) 什么是Lambda表达式
Mobile phones are a kind of MCU, but the hardware it uses is not 51 chip
01仿B站项目业务架构
在三线城市、在县城,很难毕业就拿到10K
Project cost management__ Plan value_ Earned value_ Relationship among actual cost and Countermeasures
For new students, if you have no contact with single-chip microcomputer, it is recommended to get started with 51 single-chip microcomputer
Project cost management__ Topic of comprehensive calculation