if (typeof res == 'string') {
try {
var obj=JSON.parse(res);
if(typeof obj == 'object' && obj ){
console.log('是JSON');
return true;
}else{
return false;
}
} catch(e) {
console.log('error:'+res+'!!!'+e);
return false;
}
}
判断后端返回的数据是否为JSON数据格式(异常日志)
最新推荐文章于 2023-08-14 14:52:37 发布