数据格式:
data: "{"sourceStatMap":{"face":18924,"car":0,"imsi":15754,"mac":3588952},"distinctSourceStatMap":{"face":2233,"car":0,"imsi":3758,"mac":32250},"distinctTodaySourceStatMap":{"face":0,"car":0,"imsi":0,"mac":0},"todaySourceStatMap":{"face":0,"car":0,"imsi":0,"mac":0}}"
需要将字符串对象解析出来
方法(使用 eval() 转换,需要在 json 字符外包裹一对小括号)
let obj = eval('(' + data + ')');
最终解析的结果:
{ "sourceStatMap":{ "face":18924, "car":0, "imsi":15754, "mac":3588952 }, "distinctSourceStatMap":{ "face":2233, "car":0, "imsi":3758, "mac":32250 }, "distinctTodaySourceStatMap":{ "face":0, "car":0, "imsi":0, "mac":0 }, "todaySourceStatMap":{ "face":0, "car":0, "imsi":0, "mac":0 } }