2025-03-31 02:41:18
// 所谓json格式,无非就是对象或者数组
// 就是所谓的{}、[]
var str = " {}";
var obj = null;
try{
obj = eval("(" + str + ")");
}catch(e){
}
var xy = Object.prototype.toString.call(obj);
if (xy == "[object Object]" || xy == "[object Array]") {
console.log("是json格式");
} else {
console.error("不是json格式");
}
2025-03-31 02:37:11
2025-03-31 01:32:41