C#中Newtonsoft.Json 序列化和反序列化 时间格式
//1、using 引用
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
//2、 日期的格式
IsoDateTimeConverter timeFormat = new IsoDateTimeConverter();
timeFormat.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
//3、调用
object obj = new object();
string sResult= Newtonsoft.Json.JsonConvert.SerializeObject(obj, timeFormat);
Newtonsoft.Json 转Json字符串为空不序列化
JsonSerializerSettings mJsonSettings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
JsonConvert.SerializeObject(WFDefine ,Newtonsoft.Json.Formatting.None, mJsonSettings);