如何访问以下json输出中的每个元素

时间:2013-11-23 12:23:13

标签: json model-view-controller

这是我的j-son输出,我想访问内部元素元素。 我该怎么做? 我试图通过以下方式访问它们 数据[10]; 但它没有奏效

public JsonResult ShowEventsList()
        {
            using (EventSchedularEntities db = new EventSchedularEntities())
            {
                var EventsList = from evnt in db.Events
                                 select new
                                 {
                                     id = evnt.EventID,
                                     Subject = evnt.EventName,

                                     Description = evnt.EventDesc,
                                     StartTime = evnt.EventDateBegin,
                                     EndTime = evnt.EventDateEnd,
                                     Color = evnt.Importance,

                                 };
                List<object[]> LstEvents = new List<object[]>();
                foreach (var ev in EventsList)
                {
                    LstEvents.Add(new object[] { ev.id, ev.Subject, ev.Description,DateTime.Parse(ev.StartTime.ToString()).ToString("M/dd/yyyy hh:mm").Replace("-", "/"), DateTime.Parse(ev.EndTime.ToString()).ToString("M/dd/yyyy hh:mm").Replace("-", "/"), ev.Color });
                }

                return Json( LstEvents, JsonRequestBehavior.AllowGet);

            }

        }



    $.ajax({
        type: "POST",
        url: "../EventScheduler/ShowEventsList",
        datatype: "json",
        success: function (result)
        {

            var data = JSON.parse(result);
            alert(data);
        }

enter image description here

0 个答案:

没有答案