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
使用FieldBased无法映射is开头的boolean类型,在打印解析对象的时候会多一个属性值,并且会影响下面的toJSONString打印结果
测试类: @DaTa public class TestB { private boolean isSuccess = false; } 测试方法: public static void main(String[] args) { String str = "{"success":true}"; TestB testB = JSON.parseObject(str, TestB.class, JSONReader.Feature.FieldBased); System.out.println(JSON.toJSONString(testB)); TestB testB1 = new TestB(); testB1.setSuccess(true); System.out.println(JSON.toJSONString(testB1)); }
期望打印 {"success":false} {"success":true}
{"isSuccess":false,"success":false} {"isSuccess":true,"success":true}
The text was updated successfully, but these errors were encountered:
bug fix for serialize single field Object, fix issue #599
ab8f497
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.11-SNAPSHOT/ 问题已修复,请用2.0.11-SNAPSHOT版本帮忙验证,2.0.11版本预计在8月7日发布
Sorry, something went wrong.
https://github.com/alibaba/fastjson2/releases/tag/2.0.11 问题已修复,请用新版本
No branches or pull requests
问题描述
使用FieldBased无法映射is开头的boolean类型,在打印解析对象的时候会多一个属性值,并且会影响下面的toJSONString打印结果
环境信息
重现步骤
测试类:
@DaTa
public class TestB {
private boolean isSuccess = false;
}
测试方法:
public static void main(String[] args) {
String str = "{"success":true}";
TestB testB = JSON.parseObject(str, TestB.class, JSONReader.Feature.FieldBased);
System.out.println(JSON.toJSONString(testB));
TestB testB1 = new TestB();
testB1.setSuccess(true);
System.out.println(JSON.toJSONString(testB1));
}
期待的正确结果
期望打印
{"success":false}
{"success":true}
相关日志输出
{"isSuccess":false,"success":false}
{"isSuccess":true,"success":true}
The text was updated successfully, but these errors were encountered: