Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION]FastJson2开启autoType数组类型丢失 #3154

Open
wongjones opened this issue Nov 8, 2024 · 1 comment
Open

[QUESTION]FastJson2开启autoType数组类型丢失 #3154

wongjones opened this issue Nov 8, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@wongjones
Copy link

使用场景

使用Map<String, Object>接收参数,使用FastJson2序列化Map<String, Object>设置JSONWriter.Feature.WriteClassName, 以保存原始类类信息,序列化的字符串存储下来,在需要使用时取出反序列化,Map<String, Object>参数中所有value类型恢复为原来的类型

问题

测试发现,对于Object类型可以还原,但是对于数组类型(int[], byte[], List)无法还原出来,反序列化出来为JSONArray,对于无法明确知道用户传入的Object类型时,无法正确转换为对应的类型

测试代码

json_case

对比验证

测试了Jackson是可以还原的,对于基本类型数组、包装类型数组均可以还原

@wongjones wongjones added the enhancement New feature or request label Nov 8, 2024
@wongjones wongjones changed the title FastJson2开启autoType数组类型丢失 【BUG】FastJson2开启autoType数组类型丢失 Nov 8, 2024
@wongjones wongjones changed the title 【BUG】FastJson2开启autoType数组类型丢失 [QUESTION]FastJson2开启autoType数组类型丢失 Nov 8, 2024
@wongjones
Copy link
Author

FastJson版本2.0.53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant