[]是数组;{}是对象;
首先判断接受的数据是否是正确的json格式对象
第一种形式 [[ ]]
[["12","32","56","10","67","89","12","12","8","42","33","9"]]
怎么处理上面的数据,处理以后是以下的形式;因为我要在页面上循环遍历
["12","32","56","10","67","89","12","12","8","42","33","9"]
解决方案 eval(数据)
eval(数据)可以对数据进行运算,例如返回数组对象,自动去掉外面多于的[]
this.tableData=eval(e.data);
第二种形式 {"属性名":"属性值"}
{"sz":["12","32","56","10","67","89","12","12","8","42","33","9"]}
我要获取["12","32","56","10","67","89","12","12","8","42","33","9"]
解决方案
var obj = eval('(' + e.data + ')');
alert(obj.sz);
this.tableData=obj.sz;
后续再会补充.............