代码改变世界

C#后台list转化为json格式

2018-12-27 16:44  马尔代夫_珍  阅读(3758)  评论(0编辑  收藏  举报

public ActionResult GetData()
{
var lst = new List<Model.calendarevent>();
lst.Add(new Model.calendarevent
{
allDay = true,
confid = 1,
confname = "工作",
confshortname = "M1",
description = "",
end = "2018-12-14 08:30:00",
start = "2018-12-14 08:00:00",
fullname = "开会",
id = 1,
noteType = 1,
sid = 2,
title = "记事簿",
topic = "记事簿",
uid = 3
});
return Json(lst, JsonRequestBehavior.AllowGet);
}

 

写一个model,直接把需要字段添加到model里面,返回这个就行