/// <summary> /// Deserialize the JSON GZIP compressed string into a model /// </summary> /// <param name="jsonModel">JSON string to be serialized</param> /// <typeparam name="T">Type of ModelBase</typeparam> /// <returns>Model</returns> public static T DeserializeCompressed <T>(string jsonModel) { return(JsonConvert.DeserializeObject <T>(Gzip.DecompressJson(jsonModel), JsonSerializerSettings)); }
/// <summary> /// Serializes the model into JSON string compressed using GZIP /// </summary> /// <param name="model">Model to be serialized</param> /// <typeparam name="T">Type of ModelBase</typeparam> /// <returns>JSON string</returns> public static string SerializeWithCompression <T>(T model) { return(Gzip.CompressJson(JsonConvert.SerializeObject(model, JsonSerializerSettings))); }