fastjson 递归方法在遇到数组里有null会出异常

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

case:
{"key1":"value1", "key2":[null] }
or
{"key1":"value1", "key2":[null,"value2"] }
JSONObject jsonBody = JSONObject.parseObject(str) JSONPath.eval(jsonBody , "$..key2")
就会抛出异常~ 在version:1.2.60 会抛 npe
在新的版本,会抛出其它异常

uemypmqf

uemypmqf1#

I not found exception in your code

String s = "{\"key1\":\"value1\", \"key2\":[null,\"value2\"] }";
        JSONObject jsonBody = JSONObject.parseObject(s);
        JSONPath.eval(jsonBody, "$..key2");

please give me the code which can throw exception

相关问题