You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Json格式转换
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class JsonChange
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Model 实体转json
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Model">可以是单个实体,也可是实体集(即:ToList())</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|