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

SupportAutoType 模式下嵌套的HashMap 转换失败 #2693

Closed
liuzhenpeng opened this issue Jun 12, 2024 · 1 comment
Closed

SupportAutoType 模式下嵌套的HashMap 转换失败 #2693

liuzhenpeng opened this issue Jun 12, 2024 · 1 comment
Labels
bug Something isn't working fixed
Milestone

Comments

@liuzhenpeng
Copy link

问题描述

SupportAutoType 模式下嵌套的HashMap 转换失败

环境信息

请填写以下信息:

  • OS信息:window
  • JDK信息: [e.g.:Openjdk 1.8.0_312]
  • 版本信息::Fastjson2 2.0.50

重现步骤

class FormInstance{
String id
Map<String, Object> widgets
}
String str="{"@type":"com.example.FormInstance","id":"jdjdjksjkjskddd111","widgets":{"@type":"java.util.HashMap","_S_SERIAL":"LYBD-20240611-001"}}"

FormInstance formInstance = JSON.parseObject(str, FormInstance.class,Feature.SupportAutoType);
转换后 widgets 为空,

  1. 使用 JSON.parseObject(str, FormInstance.class,Feature.SupportAutoType);
  2. FormInstance formInstance = JSON.parseObject(str, FormInstance.class,Feature.SupportAutoType);
  3. 出现 ... 错误
    转换后 widgets 为空

期待的正确结果

widgets 能够转换为HashMap

附加信息

如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。
FastJson1.2.83是正常可以支持的

@liuzhenpeng liuzhenpeng added the bug Something isn't working label Jun 12, 2024
rowstop added a commit to rowstop/fastjson2 that referenced this issue Jun 13, 2024
@wenshao wenshao added this to the 2.0.52 milestone Jun 16, 2024
@wenshao wenshao added the fixed label Jun 16, 2024
@wenshao
Copy link
Member

wenshao commented Jul 14, 2024

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

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

No branches or pull requests

2 participants