JsonContentDeserializer Class

Namespace
Kampute.HttpClient.Json
Assembly
  • Kampute.HttpClient.Json.dll

Definition

Provides functionality for deserializing JSON content from HTTP responses into objects.
public sealed class JsonContentDeserializer : HttpContentDeserializer
Inheritance

Constructors

JsonContentDeserializer()

Initializes a new instance of the JsonContentDeserializer class.
public JsonContentDeserializer()

Properties

Options

Gets or sets the JSON deserialization options.
public JsonSerializerOptions Options { get; set; }

Property Value

JsonSerializerOptions
The JSON deserialization options, 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

content HttpContent
The HttpContent to read from.
modelType Type
The type of the object to read.
cancellationToken CancellationToken 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 content or modelType is null.