-
Notifications
You must be signed in to change notification settings - Fork 511
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[BUG]序列化Set<Date>类型的数据异常,导致解析报错 #2475
Comments
使用2.0.50-SNAPSHOT可正常解析,不报错。序列化后的JSON字符串没有变化,List和Set的解析结果不一致(Set带类名,List不带类名),不知是否有意为之。 附测试代码
输出结果 JsonString: {"@type":"FastJson2Test$TestDto","collListDate":["2024-04-28 09:14:12.768"],"collSetDate":Set[new Date(1714266852768)],"id":"5466fe74-8cd9-4f58-86e6-f98e8f93df3e"} Json: FastJson2Test.TestDto(id=5466fe74-8cd9-4f58-86e6-f98e8f93df3e, collSetDate=[Sun Apr 28 09:14:12 CST 2024], collListDate=[Sun Apr 28 09:14:12 CST 2024]) |
Set带类名设计就是这样的 https://github.com/alibaba/fastjson2/releases/tag/2.0.50 |
问题描述
使用GenericFastJsonRedisSerializer或者JSON.toJSONString方法序列化到Redis,对象中存在Set类型的字段,序列化到Redis的数据为“Set[new Date(xxxxxxxxxxxxxxx)]”,当从Redis反序列化到对象的时候,报错“string length only support string input”。将Set类型改为List则能正确的序列化并可正确反序列化
环境信息
The text was updated successfully, but these errors were encountered: