Python微信订餐小程序课程视频
https://edu.csdn.net/course/detail/36074
Python实战量化交易理财系统
https://edu.csdn.net/course/detail/35475
先说结论:
fastjson在把对象转换成字符串的时候,如果遇到相同的对象的时候,默认开启引用检测将相同的对象写成引用的形式。
官网文档:https://github.com/alibaba/fastjson/wiki
问题出现的背景:
在开发过程中,使用了第三方的拓扑图组件。组件生成图形的json字符串在利用 fastjson 转换成 JSON 对象的时候报错如下所示:
Exception in thread "main" com.alibaba.fastjson.JSONException: illegal ref, int
后来定位到如下的字符串解析的时候会出错:
public class test {
public static void main(String[] args) {
String str1 = "{\"$position\":{\"$ref\":21}}";
String