Пример #1
0
        public object Deserialize(string contentType, Stream bodyStream, BindingContext context)
        {
            var deserializedObject = JsonSerializer.DeserializeFromStream(context.DestinationType, bodyStream);

            if (context.DestinationType.GetProperties(BindingFlags.Public | BindingFlags.Instance).Except(context.ValidModelProperties).Any())
            {
                return(CreateObjectWithBlacklistExcluded(context, deserializedObject));
            }

            return(deserializedObject);
        }
Пример #2
0
        public override Task <object> ReadFromStreamAsync(Type type, Stream readStream, System.Net.Http.HttpContent content, IFormatterLogger formatterLogger)
        {
            var task = Task <object> .Factory.StartNew(() => JsonSerializer.DeserializeFromStream(type, readStream));

            return(task);
        }