JsonContentDeserializer Class
- Namespace
- Kampute.HttpClient.NewtonsoftJson
- Assembly
- Kampute.HttpClient.NewtonsoftJson.dll
Definition
Provides functionality for deserializing JSON content from HTTP responses into objects.
public sealed class JsonContentDeserializer : HttpContentDeserializer- Inheritance
- object
- HttpContentDeserializer
- JsonContentDeserializer
Constructors
JsonContentDeserializer()
Initializes a new instance of the JsonContentDeserializer class.
public JsonContentDeserializer()Properties
Settings
Gets or sets the JSON deserialization settings.
public JsonSerializerSettings Settings { get; set; }Property Value
- JsonSerializerSettings
- The JSON deserialization settings, if any.
Methods
DeserializeAsync(HttpContent, Type, CancellationToken)
Asynchronously reads an object from the provided HttpContent.
public override Task<object> DeserializeAsync(HttpContent content, Type modelType, CancellationToken cancellationToken = default)Parameters
contentHttpContent- The HttpContent to read from.
modelTypeType- The type of the object to read.
cancellationTokenCancellationToken optional- A token for canceling the read operation (optional).
Returns
- Task<object>
- A task representing the asynchronous read operation, containing the deserialized object.
Exceptions
- ArgumentNullException
- Thrown if
contentormodelTypeisnull.
