fastjson 带类型的json串{ "@type": "com.ysxs.dmp.condition.AccessCondition", "child": null, "range": "EVERY_ONE", "labelId": "A01", "endValue": 3, "flowType": [ "_4G" ], "relation": "AND", "startValue": 1, "endCalculation": "LT", "startCalculation": "GT", "hour": [ 1, 2, 3, 4, 5 ], "sss": [ "23", "46" ] }
如果反序列化对象中存在父子关系,使用父类作为parser对象时 ,则序列化顺序导致数据丢失{ "hour": [ 1, 2, 3, 4, 5 ], "@type": "com.ysxs.dmp.condition.AccessCondition", "child": null, "range": "EVERY_ONE", "labelId": "A01", "endValue": 3, "flowType": [ "_4G" ], "relation": "AND", "startValue": 1, "endCalculation": "LT", "startCalculation": "GT", "sss": [ "23", "46" ] }
该json丢失了hour,如果放到@type后,该数据则不会丢失
3条答案
按热度按时间mefy6pfw1#
最新版本扔出现问题
4si2a6ki2#
@wenshao 大佬,帮忙看一下, 是我用法不对吗?
s5a0g9ez3#
@type只能放在最先的位置,设计上就是这样的