using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web.Script.Serialization; namespace SLH.SSDMS.Common { /// /// Json格式转换 /// public class JsonChange { /// /// Model 实体转json /// /// 可以是单个实体,也可是实体集(即:ToList()) /// public static string ModeToJson(object Model) { JavaScriptSerializer serializer = new JavaScriptSerializer(); string str = serializer.Serialize(Model); //HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json") }; //return result; return str; } } }