小程序json字符串转json对象
var that = this
var jsonStr = options.json;
if (typeof jsonStr != 'object') {
jsonStr = jsonStr.replace(/\ufeff/g, "");//重点
var jobj = JSON.parse(jsonStr);// 转对象
options.json = jobj;
}
that.setData({
jdata : options.json
})
网友评论