Table of Contents

Class JsonContentDeserializer

Namespace
Kampute.HttpClient.NewtonsoftJson
Assembly
Kampute.HttpClient.NewtonsoftJson.dll

Provides functionality for deserializing JSON content from HTTP responses into objects.

public sealed class JsonContentDeserializer : HttpContentDeserializer, IHttpContentDeserializer
Inheritance
JsonContentDeserializer
Implements
Inherited Members

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

content HttpContent

The HttpContent to read from.

modelType Type

The type of the object to read.

cancellationToken CancellationToken

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.