javascript的eval方法来处理action层传回的json字符串成javascript对象

对于这么一个正常的字符串data:{"id":1111,"parentDetailId":null,"detailCode":"1111","detailName":"小樱","detailLevel":null,"detailCarrCode":null,"detailCarrName":null,"keepDateCode":null,

"keepDateName":null,"deliverDeptCode":null,"deliverDeptName":null,"saveSite":null,

"deliverRound":null,"verifyRound":null,"shelfRound":null,"shelfType":null,"batchFlag":null,

"detailTBNM":null,"createDTTM":null,"createId":null,"templateUrl":null,"fieldList":null}

转成javascript对象,

方法:

varaaa=null;

eval("aaa="+data+";");

方法:

varaaa=eval("("+data+")");

或者用jquery-json插件,官网:http://code.google.com/p/jquery-json/

相关推荐