alibaba / alibaba/fastjson2

[BUG] JSONField指定别名的LowerCase相同,则无法正确执行反序列化

Open
#1,037 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
4.4k
Forks
613
Avg merge
1d 22h
Merged PRs (30d)
6

Description

V2.0.21

class Bean {
@JSONField(name = "openid", alternateNames = {"OpenId"})
private String openId;
}

String json = "{\"openid\":\"xxxxxxx\"}";

反序列化时,字段openId不应为null

1.x版本无此问题
若启用SupportSmartMatch则可能规避该问题

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the Bean, @JSONField aliases, and JSON string shown in the report, then trace the deserialization path that resolves the "openid" name against the openId field. Done means deserializing this input populates openId with "xxxxxxx" without requiring SupportSmartMatch, while preserving the reported 1.x behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.