json 字符串转json 对象(服务器返回的数据)

var jsonStr = res.data;

jsonStr = jsonStr.replace(" ", "");

if (typeof jsonStr != 'object') {

jsonStr = jsonStr.replace(/\ufeff/g, ""); //重点

var jj = JSON.parse(jsonStr);

res.data = jj;

}

猜你喜欢

转载自blog.csdn.net/qq_32307891/article/details/90768392
今日推荐