示例#1
0
        public JToken DeGzipJson(byte[] jsonByte)
        {
            var jsonStr = Gzip.DeCompressStr(jsonByte);
            var jt      = JsonConvert.DeserializeObject <JToken>(jsonStr);

            return(jt);
        }
示例#2
0
        public static byte[] EnGzipJson(int reason, string message, object result, string token)
        {
            var timeConverter = new IsoDateTimeConverter();

            timeConverter.DateTimeFormat = "yyyy'-'MM'-'dd' 'HH':'mm':'ss";

            var obj = new { Reason = reason, Message = message, Result = result, Token = token };

            var jsonByte = Gzip.EnCompress(JsonConvert.SerializeObject(obj, timeConverter));

            return(jsonByte);
        }