执行代码修改静态变量全局默认关闭,就不会再对重复引用改为"$ref":xxx了
JSON.DEFAULT_GENERATE_FEATURE |= SerializerFeature.DisableCircularReferenceDetect.getMask();
关闭之前序列化出来的数据
JSON.toJSONString(detailVo);
有个"
r
e
f
"
:
"
ref":"
ref":".auditPriceDetail.addInfoList"
{"auditPriceDetail":{"addInfoList":[{"acid":"CB596A902CDD0079","amountLimit":500,"discountDetail":"荣耀Magic6系列新品以旧换新补贴(1月11日-1月31日)指定旧机, 满500加600, 加价金额:600","discountPrice":600,"discountsName":"荣耀Magic6系列新品以旧换新补贴(1月11日-1月31日)指定旧机","originalPrice":857,"value":600,"valueType":1}],"addPrice":600,"levelId":"1574336224519077889","levelPackage":"08G","originalPrice":857,"totalPrice":1457},"estimatePriceDetail":{"addInfoList":[{"acid":"CB596A902CDD0079","amountLimit":1000,"discountDetail":"荣耀Magic6系列新品以旧换新补贴(1月11日-1月31日)指定旧机, 满1000加680, 加价金额:680","discountPrice":680,"discountsName":"荣耀Magic6系列新品以旧换新补贴(1月11日-1月31日)指定旧机","originalPrice":1047,"value":680,"valueType":1}],"addPrice":680,"levelPackage":"07F","originalPrice":1047,"totalPrice":1727},"secondVisitDetail":{{"$ref":"$.auditPriceDetail.addInfoList"}"addPrice":600,"levelId":"1574336224519077889","levelPackage":"08G","originalPrice":857,"totalPrice":1457}}
关闭之后正常
{"auditPriceDetail":{"addInfoList":[{"acid":"0F6A87B0403414AF","amountLimit":300,"discountDetail":"荣耀Magic6系列新品以旧换新补贴(1月11日-1月31日)指定旧机, 满300加560, 加价金额:560","discountPrice":560,"discountsName":"荣耀Magic6系列新品以旧换新补贴(1月11日-1月31日)指定旧机","originalPrice":416,"value":560,"valueType":1}],"addPrice":560,"levelId":"1574329517856342017","levelPackage":"07F","originalPrice":416,"totalPrice":976},"estimatePriceDetail":{"addInfoList":[{"acid":"0F6A87B0403414AF","amountLimit":500,"discountDetail":"荣耀Magic6系列新品以旧换新补贴(1月11日-1月31日)指定旧机, 满500加600, 加价金额:600","discountPrice":600,"discountsName":"荣耀Magic6系列新品以旧换新补贴(1月11日-1月31日)指定旧机","originalPrice":718,"value":600,"valueType":1}],"addPrice":600,"levelPackage":"03B","originalPrice":718,"totalPrice":1318},"secondVisitDetail":{"addInfoList":[{"acid":"0F6A87B0403414AF","amountLimit":300.00,"discountDetail":"荣耀Magic6系列新品以旧换新补贴(1月11日-1月31日)指定旧机, 满300加560, 加价金额:560","discountPrice":560.00,"discountsName":"荣耀Magic6系列新品以旧换新补贴(1月11日-1月31日)指定旧机","originalPrice":416,"value":560.00,"valueType":1}],"addPrice":560,"levelId":"1574329517856342017","levelPackage":"07F","originalPrice":416,"totalPrice":976}}
序列化的时候带上SerializerFeature.DisableCircularReferenceDetect特性
JSON.toJSONString(detailVo, SerializerFeature.DisableCircularReferenceDetect);