1、首先是Java,
resJsonObj = {}
1.判断data是否为空
JSONObject dataJson =resJsonObj .getJSONObject("data");
//下边判断是否为NULL!!!
if(dataJson == null || dataJson.isEmpty() || dataJson.isNullObject() || "null".equals(dataJson)){
return "error";
}
2、JS:
var resJson={data:""};
if(resJson&&resJson.data!=""){
alert("resJson不为空")
}
else{
alert("resJson为空")
}
3、jQuery:
jQuery.isEmptyObject(obj)