success: function (res) {
console.log(res.data)
var jsonStr= res.data;
jsonStr = jsonStr.replace(" ","");
if(typeof jsonStr!= 'object'){
jsonStr= jsonStr.replace(/\ufeff/g,"");//这里是在文件读取时用到,一般不用,python中用的吧?
var jj = JSON.parse(jsonStr); //JSON字符串转成JavaScript对象
res.data = jj;
}
if (res.data.status==1){
console.log("ok")
}
小程序json字符串转JavaScript对象的方法
最新推荐文章于 2024-04-14 02:07:49 发布