We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fastjson2对布尔值序列化的问题
Fastjson 2.0.51
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.annotation.JSONField; import lombok.Builder; import lombok.Data; import org.junit.Test public class FastJSONTest { @Builder @Data public static class Student{ @JSONField(name= "is_judge") private boolean isJudge; } @Test public void testFastJson(){ Student student = Student.builder().isJudge(true).build(); System.out.println(JSONObject.toJSONString(student)); } }
输出的结果可以发现isJudge字段变成了judge,这个是和1版本不一致的,我试过1.2.83是可以转成is_judge的。使用@DaTa会为isJudge字段生成一个getter,就叫isJudge(),方法和字段同名,可能这里就是导致判断逻辑不一致的原因。我想请问这里是bug还是预期之内?
{"judge":true}
无
The text was updated successfully, but these errors were encountered:
fix boolean field annotation not work, for issue #2795
336e809
970ed31
21a66ee
https://github.com/alibaba/fastjson2/releases/tag/2.0.52 问题已修复,请用新版本
Sorry, something went wrong.
谢谢,辛苦了!
No branches or pull requests
问题描述
Fastjson2对布尔值序列化的问题
环境信息
Fastjson 2.0.51
重现步骤
期待的正确结果
输出的结果可以发现isJudge字段变成了judge,这个是和1版本不一致的,我试过1.2.83是可以转成is_judge的。使用@DaTa会为isJudge字段生成一个getter,就叫isJudge(),方法和字段同名,可能这里就是导致判断逻辑不一致的原因。我想请问这里是bug还是预期之内?
相关日志输出
{"judge":true}
附加信息
无
The text was updated successfully, but these errors were encountered: