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] Support nested duplicate keys when enable DuplicateKeyValueAsArray #1786

Closed
cxzl25 opened this issue Aug 24, 2023 · 1 comment
Closed
Labels
bug Something isn't working fixed
Milestone

Comments

@cxzl25
Copy link
Contributor

cxzl25 commented Aug 24, 2023

问题描述

String json = "{\"c1\":{\"a\":1,\"a\":2}}";
JSONObject jsonObject =JSON.parseObject(json, JSONReader.Feature.DuplicateKeyValueAsArray);
System.out.println(((JSONObject) jsonObject.get("c1")).get("a").toString());

Output

2

环境信息

请填写以下信息:

  • OS信息: [e.g.:CentOS 8.4.2105 4Core 3.10GHz 16 GB]
  • JDK信息: [e.g.:Openjdk 1.8.0_312]
  • 版本信息:Fastjson2 2.0.39

重现步骤

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

  1. 使用 xxx.xxx 方法
  2. 输入 ... 数据
  3. 出现 ... 错误
//可在此输入示例代码

期待的正确结果

[1,2]

相关日志输出

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

附加信息

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

@wenshao
Copy link
Member

wenshao commented Sep 3, 2023

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