FastJson可正常反序列化字符串null

踩坑:FastJson可正常反序列化字符串null,返回null,而不会抛出JsonException异常

1
2
3
4
5
6
7
8
try {
User user = JSON.parseObject("null", User.class);
if (user == null) {
System.out.print("user = null");
}
} catch (Exception e) {
e.printStackTrace();
}
1
2
3
public class User {
private String name;
}

Powered by AppBlog.CN     浙ICP备14037229号

Copyright © 2012 - 2020 APP开发技术博客 All Rights Reserved.

访客数 : | 访问量 :