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

[BUG],序列化再反序列化,重复引用的对象不能正确反序列化 #2348

Closed
jiao-jia-nan opened this issue Mar 20, 2024 · 6 comments
Labels
bug Something isn't working fixed
Milestone

Comments

@jiao-jia-nan
Copy link

jiao-jia-nan commented Mar 20, 2024

问题描述

序列化再反序列化,重复引用的对象不能正确反序列化。

环境信息

  • OS信息: [e.g.:CentOS 8.4.2105 4Core 3.10GHz 16 GB]
  • JDK信息: [e.g.:adopt-openjdk-11.0.9]
  • 版本信息:[e.g.:Fastjson2 2.0.47]

重现步骤

        ArrayList<Object> items = new ArrayList<>();
        HashMap<Object, Object> item = new HashMap<>();
        item.put("data","data");
        items.add(item);
        items.add(item);
        List<HashMap> newItems = JSONArray.parseArray(JSONArray.toJSONString(items),HashMap.class);

期待的正确结果

newItems ,有两个item

相关日志输出

附加信息

@jiao-jia-nan jiao-jia-nan added the bug Something isn't working label Mar 20, 2024
@wenshao
Copy link
Member

wenshao commented Mar 21, 2024

能提供更详细能直接重现问题的代码么?

@jiao-jia-nan
Copy link
Author

已更新重现步骤

@rowstop
Copy link
Contributor

rowstop commented Mar 26, 2024

没复现
image

@jiao-jia-nan
Copy link
Author

2

@jiao-jia-nan
Copy link
Author

image

@wenshao
Copy link
Member

wenshao commented Apr 14, 2024

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

@wenshao wenshao closed this as completed Apr 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

3 participants