var str = "[{'Id':'6274','rkname':'老毕','menhuid':'','cengyongming':'','sex':'','arg':'','minzu':'','shengyear':'','shengmoon':'','shengri':'','shengdi':'','zhuzhi':'','qitazhuzhi':'','jiguan':'','zongjiaoxinyang':'','sfz':'123','wenhuachengdu':'','hunyin':'','zhiye':'','fuwuchusuo':'','zhuxiaoriqi':'','zhuxiaoyuanyin':'','zhuangtai':'0','jiankang':'','shebao':'','canjidengji':'','spousename':'','spousesfz':'','peoptype':'','xidu':'','qianke':'','dengjidanwei':'','pinyin':'','jwh':'','jwhzu':'','datastart':''}]"
//str="";
var arr=[];
alert(arr.length);//此处显示: 0
//eval 只对字符串有效,其他任何形式都无法正确还原。
//当给str为""值时 eval 返回:null
arr = eval(str);
//alert(arr.length);//此处运行出错,因为arr为null
//字符串还原为数组
if(arr!=null)
alert(arr[0]['Id']);//如果注释掉str="";则此处显示: 6274
if(arr!=null)
alert(arr.length); //如果注释掉str="";则此处显示: 1
else
alert("null") //如果字符串为""则此处输出:null
//经过上边的此时可以确定:
//1.eval只对字符串有意义
//2.字符串为空时eval返回:null;
//3.如 arr=[]; 则arr.length=0; 赋值:arr = eval("");后arr为null运行alert(arr.length)出错