alibaba / alibaba/fastjson2

对象序列化后属性名被修改(驼峰转换错误)

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

Description

版本2.0.21
重现代码:
@Data
public class MyUser {

private String oAuthName;

private Integer age;

public static void main(String[] args) {
MyUser myUser = new MyUser();
myUser.setOAuthName("xiong");
myUser.setAge(25);
System.out.println(JSON.toJSONString(myUser));
// 期望输出为: {"oAuthName":"xiong","age":25}
// 实际输出为: {"OAuthName":"xiong","age":25}
}
}

Contributor guide

Open the contributing guide

Research direction

Start by running the provided MyUser reproduction with fastjson2 version 2.0.21 and inspect the serialization path for the oAuthName field. Done means serialization preserves the expected property name "oAuthName" while continuing to output age correctly.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.