alibaba / alibaba/fastjson2

[BUG] JSONObject.parseObject()反序列化时丢失部分字段

Open
#3,454 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

### 问题描述
*在使用JSONObject.parseObject()反序列化时,会丢失部分字段*

### 环境信息
*请填写以下信息:*

- OS信息: [Windows 11 13th Gen Intel(R) Core(TM) i5-13500H 2.60 GHz 32 GB]
- JDK信息: [JDK 17.0.6]
- 版本信息:[Fastjson2 2.0.56]

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

```java
public static void main(String[] args) {

String json = "{\"algorithmConfig\":[{\"name\":\"你好\"}],\"algorithmSetting\":[{\"kpDeltaTemp\":2,\"kiDeltaTemp\":0.2,\"kdDeltaTemp\":3}]}";

JSONObject parsedObject = JSONObject.parseObject(json);

System.err.println(parsedObject.toJSONString());
}
```

### 期待的正确结果
对以上json进行反序列化后,不会丢失 kiDeltaTemp 、kdDeltaTemp 字段

### 相关日志输出

![Image](https://github.com/user-attachments/assets/49f5a5f4-6eaf-4861-b43a-a01f0c0eac3b)

#### 附加信息
*如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。*

Contributor guide

Open the contributing guide

Research direction

Start by running the issue's Java example with Fastjson2 2.0.56 and compare the printed JSON with the expected fields. Then trace the behavior from the mentioned JSONObject.parseObject() entry point; done means the output retains kiDeltaTemp and kdDeltaTemp.

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
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.