You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
代码如下:属性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是否考虑也是如此?
附加信息
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)
The text was updated successfully, but these errors were encountered:
请描述您的需求或者改进建议
代码如下:属性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是否考虑也是如此?
附加信息
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)
The text was updated successfully, but these errors were encountered: