步驟
引用
using Newtonsoft.Json; using Newtonsoft.Json.Converters;
格式配置
IsoDateTimeConverter timeFormat = new IsoDateTimeConverter(); timeFormat.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
調用
object obj = new object(); string sResult= Newtonsoft.Json.JsonConvert.SerializeObject(obj, timeFormat);