[BUG]反序列化错误,json字符串字段顺序影响反序列化结果
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
```import java.math.BigDecimal;
public class DeserializeModel {
private BigDecimal amt;
private Boolean flag;
public BigDecimal getAmt() {
return amt;
}
public void setAmt(BigDecimal amt) {
this.amt = amt;
}
public Boolean getFlag() {
return flag;
}
public void setFlag(Boolean flag) {
this.flag = flag;
}
}
```
@Test
void fastJsonTest() {
String str = "{\"amt\":null,\"flag\":false}"; // 反序列化错误 {}
// String str = "{\"flag\":false, \"amt\":null}"; // 正常 {"flag":false}
DeserializeModel deserializeModel = JSON.parseObject(str, DeserializeModel.class);
System.out.println(JSON.toJSONString(deserializeModel));
}
Contributor guide
Research direction
Start with the DeserializeModel and fastJsonTest reproduction in the issue, running both JSON field orders to confirm the differing serialized results. Trace the deserialization path responsible for BigDecimal null and Boolean false values, then add a regression test showing that field order does not change the result.
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
- 42/100