using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.Unicode;
using System.Threading.Tasks;
public static class ObjectExtensions
{
///
/// 使用Newtonsoft Json将object转换为Json字符串
///
///
///
public static string ToJson(this object @this)
{
JsonSerializerSettings jsonSettings = new JsonSerializerSettings
{
DateFormatString = "yyyy-MM-dd HH:mm:ss",
};
var str = Newtonsoft.Json.JsonConvert.SerializeObject(@this, jsonSettings);
return str;
}
}