引用System.Web.Extensions
添加 命名空间 using System.Web.Script.Serialization;
var serializer = new javaScriptSerializer();
serializer.MaxJsonLength = Int32.MaxValue; var result = new ContentResult { Content = serializer.Serialize(data), //data为要序列化的LINQ对象 ContentType = "application/json" }; return result;新闻热点
疑难解答