alibaba / alibaba/fastjson2

fastjson升级成2.025 JSONField 无效

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

### 问题描述
*简要描述您碰到的问题。*

fastjson升级成2.025 JSONField 无效
### 环境信息
*请填写以下信息:*

- OS信息: [e.g.:windows 16 GB]
- JDK信息: [e.g.:Openjdk 1.8.0_312]
- 版本信息:[e.g.:Fastjson2.0.25]

### 重现步骤
*如何操作可以重现该问题:*

1. 使用 `JSON.toJSONString` 方法
2. 输入 `QueryStationInfoParam queryStationInfoParam = new QueryStationInfoParam();
queryStationInfoParam.setPageNo(100);
queryStationInfoParam.setPageSize(100);` 数据
3. 出现 `序列化结果和预期不一致` 错误

```java
bean类:
![Uploading image.png…]()

测试代码
QueryStationInfoParam queryStationInfoParam = new QueryStationInfoParam();
queryStationInfoParam.setPageNo(100);
queryStationInfoParam.setPageSize(100);

logger.info("params {}", JSON.toJSONString(queryStationInfoParam));

测试结果:hargingServiceImplTest - params {"pageNo":100,"pageSize":100}
```

### 期待的正确结果
{"PageNo":100,"PageSize":100}

### 相关日志输出
*{"pageNo":100,"pageSize":100}*

#### 附加信息

Contributor guide

Open the contributing guide

Research direction

No repository file or test is named. Start by reproducing the issue through JSON.toJSONString with QueryStationInfoParam and inspect how its JSONField configuration is applied during serialization. Done means the configuration is honored and the output uses the expected PageNo and PageSize names.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.