如何判断json对象为空
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:varresJson={data:"&孥恶膈茯quot;};if(resJson&&resJson.data岿滗欣橡!=""){alert("resJson不为空")}else{alert("resJson为空")}
3、jQuery:jQuery.isEmptyObject(obj)
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:48
阅读量:73
阅读量:28
阅读量:30
阅读量:48