[BUG]JSON.toJSON和JSON.toJSONString对值为null的属性处理逻辑不一致
Open
bug
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
### 问题描述
使用默认feature时,JSON.toJSON和JSON.toJSONString对值为null的属性处理逻辑不一致,
JSON.toJSON保留了值为null的属性,JSON.toJSONString则忽略了null值属性。
### 期待的正确结果
JSON.toJSON默认也忽略null值属性,除非显式指明JSONWriter.Feature.WriteNulls。
Contributor guide
Research direction
Start at the JSON.toJSON and JSON.toJSONString entry points mentioned in the issue, then reproduce their handling of null-valued properties with default features and with JSONWriter.Feature.WriteNulls. Add a regression test showing that the default JSON.toJSON result omits null properties while WriteNulls preserves them.
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
- 45/100