Skip to content
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]JSON对于数组序列化后再反序列化对象类型错误 #2175

Closed
zhongliang-lu opened this issue Jan 11, 2024 · 3 comments
Closed
Labels
bug Something isn't working fixed
Milestone

Comments

@zhongliang-lu
Copy link

问题描述

简要描述您碰到的问题。
JSON对于数组序列化后再反序列化对象类型错误
TestER te=new TestER(); te.setName("ER"); List<TestER[]> list1=new ArrayList<TestER[]>(); list1.add(new TestER[] {te,te}); list1.add(new TestER[] {te,te}); byte[] by1= JSON.toJSONBytes(list1,JSONWriter.Feature.WriteClassName ); Object tob1=JSON.parseObject(by1, list1.getClass(), JSONReader.autoTypeFilter("grpc") );
tob1对象的类属性为。ArrayList.JSONArray.JSONObject

JSONB 可以正常反序列化对象

环境信息

请填写以下信息:

  • OS信息: [windos]
  • JDK信息: [Openjdk 18.0.2]
  • 版本信息:[Fastjson2 2.0.44]

重现步骤

如何操作可以重现该问题:
如上代码

期待的正确结果

对您期望发生的结果进行清晰简洁的描述。
JSONB一样处理

相关日志输出

请复制并粘贴任何相关的日志输出。

附加信息

如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。

@zhongliang-lu zhongliang-lu added the bug Something isn't working label Jan 11, 2024
@rowstop
Copy link
Contributor

rowstop commented Jan 11, 2024

类型丢失了

@wenshao
Copy link
Member

wenshao commented Jan 13, 2024

https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.46-SNAPSHOT/
问题已修复,请帮忙用2.0.46-SNAPSHOT版本验证,正式版本预计在3月初发布。

@wenshao
Copy link
Member

wenshao commented Jan 29, 2024

https://github.com/alibaba/fastjson2/releases/tag/2.0.46
问题已修复,请用新版本

@wenshao wenshao closed this as completed Jan 29, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

3 participants