/// <summary> /// Asynchronously deserialise data from an input stream. /// </summary> /// <param name="context"> /// Contextual information about the data being deserialised. /// </param> /// <param name="stream"> /// The input stream from which to read serialised data. /// </param> /// <returns> /// The deserialised object. /// </returns> public Task <object> ReadAsync(InputFormatterContext context, Stream stream) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (stream == null) { throw new ArgumentNullException(nameof(stream)); } using (TextReader reader = context.CreateReader(stream)) { JsonSerializer serializer = JsonSerializer.Create(SerializerSettings); object data = serializer.Deserialize(reader, context.DataType); return(Task.FromResult(data)); } }