alibaba / alibaba/fastjson2

[BUG]无符号类型字段转成 json后字段名被修改了

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

### 问题描述
```kotlin
public data class TestData(
val ms: ULong,
val x: Float,
val y: UInt,
)
```
被转成了
```json
{"ms-s-VKNKU":1231111111,"x":1.0,"y-pVg5ArA":2}
```

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

- OS信息: macos 15.0
- JDK信息: zulu-17.jdk
- 版本信息:com.alibaba.fastjson2:fastjson2-kotlin:2.0.53

### 重现步骤
```kotlin
println(TestData(1231111111u, 1.0f, 2u).toJSONString())
```

### 期待的正确结果
*对您期望发生的结果进行清晰简洁的描述。*
```json
{"ms":1231111111,"x":1.0,"y":2}
```

### 相关日志输出

#### 附加信息

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the Kotlin TestData example and its toJSONString() call using fastjson2-kotlin 2.0.53. Trace the Kotlin serialization path for ULong and UInt fields; done means the output preserves the field names as ms and y while retaining the shown numeric values.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.