(整理) Json语法规则
1 { 2 "staff":[ 3 {"name":"haha1", "age":20}, 4 {"name":"haha2", "age":20}, 5 {"name":"haha3", "age":20}, 6 ] 7 } 8 var json = '{"staff":[{"name":"haha1", "age":20},{"name":"haha2", "age":20},{"name":"haha3", "age":20}]}'; 9 ----var jsonobj = JSON.parse(json);
----var jsonobj = eval('(' + json + ')'); 10 alert(jsonobj.staff[0].name);
字符串--双引号
逻辑值--true/false
数组--[]
对象--{}