Skip to content
New issue

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

[FEATURE]fastjson2.0.6反序列化Boolean时的兼容问题 #429

Closed
HuShao96 opened this issue Jun 7, 2022 · 2 comments
Closed

[FEATURE]fastjson2.0.6反序列化Boolean时的兼容问题 #429

HuShao96 opened this issue Jun 7, 2022 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@HuShao96
Copy link

HuShao96 commented Jun 7, 2022

请描述您的需求或者改进建议

代码如下:属性d为Boolean类型;当我转成对象的时候:由于d为空字符串,所以报错
String ss ="{"a":null,"b":"","c":[],"d":"","date":"2022-06-07"}";
System.out.println(JSON.parseObject(ss,Entity.class));

描述您考虑过的替代方案

1.x版本是可以把这个进行过滤掉的;;2.x是否考虑也是如此?

附加信息

image

Exception in thread "main" com.alibaba.fastjson2.JSONException: can not convert to boolean :
at com.alibaba.fastjson2.JSONReader.readBoolValue(JSONReader.java:1333)
at com.alibaba.fastjson2.JSONReader.readBool(JSONReader.java:1266)
at com.alibaba.fastjson2.reader.FieldReaderBoolMethod.readFieldValue(FieldReaderBoolMethod.java:19)
at com.alibaba.fastjson2.reader.ObjectReader5.readObject(ObjectReader5.java:300)
at com.alibaba.fastjson2.JSON.parseObject(JSON.java:421)
at FastJsonTest.main(FastJsonTest.java:30)

@HuShao96 HuShao96 added the enhancement New feature or request label Jun 7, 2022
@wenshao wenshao added this to the 2.0.7 milestone Jun 7, 2022
@wenshao
Copy link
Member

wenshao commented Jun 7, 2022

@wenshao
Copy link
Member

wenshao commented Jun 11, 2022

https://github.com/alibaba/fastjson2/releases/tag/2.0.7
问题已经修复,请用新版本

@wenshao wenshao closed this as completed Jun 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants