这里仅仅讲net.sf.json.JSONObject
JSONObject JsonObj = JSONObject.fromObject("{'a':null,'b':'null'}");
if (JsonObj.get("a") instanceof JSONNull) {
System.out.println(" a is empty null ");
} else {
System.out.println(" a is String null ");
}
if (JsonObj.get("b") instanceof JSONNull) {
System.out.println(" b is empty null ");
} else {
System.out.println(" b is String null ");
}
打印结果:
a is empty null
b is String null