alibaba / alibaba/fastjson2

FastJsonHttpMessageConverter序列化bug

Open
#1,352 1 comment 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

### 问题描述
*简要描述您碰到的问题。*
使用fastjson2-extension-spring5:2.0.27中的FastJsonHttpMessageConverter序列化数据返回有bug,样例数据通过hutool中ObjectUtil.serialize()序列化后存入附件中
问题数据如图
![image](https://user-images.githubusercontent.com/17512402/231455594-bbb7af23-17d2-4c53-8f7c-0cdaff6e5567.png)
同样的数据直接通过JSON.toJsonString方法能正常序列化
### 环境信息
*请填写以下信息:*

- OS信息: win11
- JDK信息:
Runtime version: 17.0.6+10-b829.5 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11.0
GC: G1 Young Generation, G1 Old Generation
- 版本信息:[e.g.:Fastjson2 2.0.27]

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

1. 使用 `xxx.xxx` 方法
2. 输入 `...` 数据
3. 出现 `...` 错误
```java
//可在此输入示例代码
```
实体类
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserRequestAddProduct implements Serializable{
private static final long serialVersionUID = 1L;
private Long id;
private Long merchantId;
private String merchantName;
private Long addNumber;
private String requestJson;
private String relatedIds;
private Long reviewState;
private String revewMemo;
private String reviewUsername;
private String reviewTime;
private String filed1;
private String filed2;
private String filed3;
private String filed4;
private String filed5;
private String filed6;
private String createdAt;
private List products;
}
[test.txt](https://github.com/alibaba/fastjson2/files/11211400/test.txt)

### 期待的正确结果
*对您期望发生的结果进行清晰简洁的描述。*

### 相关日志输出
*请复制并粘贴任何相关的日志输出。*

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

Contributor guide

Open the contributing guide

Research direction

Start by inspecting FastJsonHttpMessageConverter in fastjson2-extension-spring5:2.0.27 and compare its handling of the attached test.txt data with JSON.toJsonString and Hutool ObjectUtil.serialize(). The issue is complete when the reported data serializes correctly through the converter, with a reproducible test or example confirming the result.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.