alibaba / alibaba/fastjson2

[BUG]为什么fastjson2序列化时个别字段首字母变成了大写,但是fastjson却是正常的

Open
#2,825 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

### 问题描述
为什么fastjson2序列化时个别字段首字母变成了大写,但是fastjson却是正常的?具体:
Bean Field
![c2c2c4e0-e72a-462d-8d71-2df387124582](https://github.com/user-attachments/assets/f677dd55-6dd1-4f45-ad07-4b4dc23721f6)
Serialize Result
![c100cb37-d291-4849-8ed0-34211e0c0a85](https://github.com/user-attachments/assets/00a6dbaf-93c9-4445-bccb-b2fc462f6a70)

### 环境信息

- OS信息: [e.g.:Mac]
- JDK信息: [e.g.:Openjdk 1.8.0_341]
- 版本信息:[e.g.:Fastjson2 2.0.20]

### 重现步骤
始终重现,JSON.toJSONString(bean)

### 期待的正确结果
期待应该严格按照bean field序列化

### 相关日志输出

#### 附加信息

Contributor guide

Open the contributing guide

Research direction

Start at the JSON.toJSONString(bean) entry point and compare fastjson2's output with fastjson for the bean shown in the attached images. Reproduce the field-name capitalization difference and inspect the serializer's field naming behavior. Done means bean fields retain their expected names in the serialized JSON and the regression is covered by a test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.