fastjson 建议将空字符串反序列化成集合类抛异常,改为返回为null

ars1skjm  于 2021-11-27  发布在  Java
关注(0)|答案(1)|浏览(421)

版本(1.2.54)
//抛异常com.alibaba.fastjson.JSONException: exepct '[', but EOF, pos 0, line 1, column 1
Map<String, Object> map = JSON.parseObject("", new TypeReference<Map<String, Object>>() {});
List list = JSON.parseObject("", new TypeReference() {});
Set set = JSON.parseObject("", new TypeReference() {});

//返回为null
Object object= JSON.parseObject("", new TypeReference() {});

相关问题