js 验证是否为json对象

2017-11-21 07:20:13

var isJson = function(obj){
var isjson = typeof(obj) == "object" && Object.prototype.toString.call(obj).toLowerCase() == "[object object]" && !obj.length
return isjson;
}
t = isJson(obj);
alert(t);

点赞

发表回复

电子邮件地址不会被公开。必填项已用 * 标注