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

json串中存在类似同名的字段时,反序列化获取数据异常 #4513

Open
LowAndroider opened this issue Jul 8, 2024 · 0 comments

Comments

@LowAndroider
Copy link

LowAndroider commented Jul 8, 2024

{
    "mchareaCode": [
    ],
    "mchAreaCode": [
        "5500",
        "5510",
        "985510"
    ]
}

直接反序列化到下面的实体类时,mchAreaCode会被赋值为 JSON串的mchareaCode值

@Data
class A {
    private JSONArray mchAreaCode;
}

加入JSONField,mchAreaCode还是会被赋值为 JSON串的mchareaCode值

@Data
class A {
    @JSONField(name = "mchAreaCode")
    private JSONArray mchAreaCode;
}

虽然知道JSON串数据有问题,但是这么个反序列化的逻辑问题应该更大
这里使用的fastjson版本为1.2.83

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

No branches or pull requests

1 participant