function isJSON(str) {
if (typeof str == 'string') {
try {
var obj=JSON.parse(str);
if(typeof obj == 'object' && obj ){
return true;
}else{
return false;
}
} catch(e) {
return false;
}
}
}
js判断字符串是否是json格式
猜你喜欢
转载自blog.csdn.net/weixin_43412413/article/details/103469753
今日推荐
周排行