[BUG] Double类型序列化结果和fastjson1不一致
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
### 问题描述
*简要描述您碰到的问题。*
Double类型当为1.0、2.0、3.0类似值时,toJSONString结果和fastjson1中的不一致
fastjson1中会判断是否以.0结尾,然后去除.0

而fastjson2中,1.0转换后就是1.0
### 环境信息
*请填写以下信息:*
- OS信息: [e.g.:Android 14 Xiaomi HyperOS Redmi K60]
- JDK信息: [e.g.:Openjdk 1.8.0_312]
- 版本信息:[e.g.:Fastjson2 2.0.43.android4]
### 重现步骤
*如何操作可以重现该问题:*
```java
JSON.toJSONString(1.0d)
```
### 期待的正确结果
*对您期望发生的结果进行清晰简洁的描述。*
和fastjson1中一样JSON.toJSONString(1.0d) --> 1
### 相关日志输出
*请复制并粘贴任何相关的日志输出。*
#### 附加信息
*如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。*
Contributor guide
Research direction
Start by tracing the JSON.toJSONString(1.0d) entry point into fastjson2's Double serialization path, then compare its output with the fastjson1 behavior described in the issue. The work is done when integral Double values such as 1.0d serialize as 1 while non-integral values retain their decimal representation, with tests covering the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100