废话少说:json是一个特有的键值对数组类型。既然是数组类型那么我们就可以这样定义
1.先定义数组
var Data = [];
2.理解键值对
对象名:值
{ "id": i, "title": titleStr, "start": new Date()"allDay": false, "color": "red", "textColor": "#fff" }
3.动态创建
for (var i = 0; i < jdata.length; i++) {
Data.push({ "id": i, "title": titleStr, "start": new Date(), "allDay": false, "color": "red", "textColor": "#fff" })
}
查看结果 alert(Data.length),alert(Data[0].id)或者Data[0]["id"]
原文地址:http://wguorun.blog.163.com/blog/static/1630623820130334443847/