zoukankan      html  css  js  c++  java
  • Newtonsoft.Json(Json.net) 的使用

     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);
        }
    }
    
  • 相关阅读:
    Linux
    Linux
    Linux
    Linux
    Linux
    Python
    Linux
    Python
    MySQL
    Python
  • 原文地址:https://www.cnblogs.com/anjou/p/6644352.html
Copyright © 2011-2022 走看看