Beispiel #1
0
        public string Serialise(T obj)
        {
            if (obj == null)
            {
                return("{}");
            }
            var serialised = JsonWorker.Serialize(obj);

            return(JsonCompressor.Compress(serialised));
        }
Beispiel #2
0
        public T Deserialise(string jsonString)
        {
            if (string.IsNullOrWhiteSpace(jsonString))
            {
                return(CreateObject(typeof(T)));
            }

            var decompressed = JsonCompressor.Decompress(jsonString);

            return(JsonWorker.Deserialize <T>(decompressed));
        }