Newtonsoft.Json(Json.net) 的使用
//Newtonsoft.Json.dll using Newtonsoft.Json; using Newtonsoft.Json.Converters; public static class JConvert { private static IsoDateTimeConverter datetimeimeFormat; static JConvert() { datetimeimeFormat = new IsoDateTimeConverter(); datetimeimeFormat.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; } public static string Serialize(object value) { return JsonConvert.SerializeObject(value, Formatting.Indented, datetimeimeFormat); } public static T Deserialize<T>(string value) { return JsonConvert.DeserializeObject<T>(value); } }