1、json字符串中只有一组
string jsonstr = "{'name':'xiaoming','age':'11','lastTime':'2016-07-26','address':'luoyang'}"; var jsonArray = eval(jsonstr);
2、json字符串中有多组
string jsonstr2 = "[{'name':'xiaoming','age':'11','lastTime':'2016-07-26','address':'luoyang'},{'name':'xiaoming2','age':'12','lastTime':'2016-07-27','address':'luoyang2'}]"; var jsonArray2= eval(jsonstr2);
3、json字符串中数组中嵌套的还有数组
string jsonstr3 = "{'name':'xiaoming','age':'11','lastTime':'2016-07-26','address':{'pro':'henan','city':'luoy'}}"; var jsonArray3 = eval('(' + jsonstr3 + ')');
4、JS中将object类型转换为json字符串
var ajaxform=$.post("kecheng_get.php",{act:'read',banji_id:banji_id,kecheng_name:kecheng_name},function(result_str){ result = JSON.parse(result_str); var back_status = result.back_status; if (back_status=='ok'){