HttpRequestJsonExtensions.ReadFromJsonAsync Method

Definition

Overloads

ReadFromJsonAsync(HttpRequest, Type, CancellationToken)

Read JSON from the request and deserialize to the specified type. If the request's content-type is not a known JSON type then an error will be thrown.

ReadFromJsonAsync(HttpRequest, Type, JsonSerializerOptions, CancellationToken)

Read JSON from the request and deserialize to the specified type. If the request's content-type is not a known JSON type then an error will be thrown.

ReadFromJsonAsync<TValue>(HttpRequest, CancellationToken)

Read JSON from the request and deserialize to the specified type. If the request's content-type is not a known JSON type then an error will be thrown.

ReadFromJsonAsync<TValue>(HttpRequest, JsonSerializerOptions, CancellationToken)

Read JSON from the request and deserialize to the specified type. If the request's content-type is not a known JSON type then an error will be thrown.

ReadFromJsonAsync(HttpRequest, Type, CancellationToken)

Read JSON from the request and deserialize to the specified type. If the request's content-type is not a known JSON type then an error will be thrown.

public static System.Threading.Tasks.ValueTask<object?> ReadFromJsonAsync (this Microsoft.AspNetCore.Http.HttpRequest request, Type type, System.Threading.CancellationToken cancellationToken = default);
static member ReadFromJsonAsync : Microsoft.AspNetCore.Http.HttpRequest * Type * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<obj>
<Extension()>
Public Function ReadFromJsonAsync (request As HttpRequest, type As Type, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Object)

Parameters

request
HttpRequest

The request to read from.

type
Type

The type of object to read.

cancellationToken
CancellationToken

A CancellationToken used to cancel the operation.

Returns

ValueTask<Object>

The task object representing the asynchronous operation.

Applies to

ReadFromJsonAsync(HttpRequest, Type, JsonSerializerOptions, CancellationToken)

Read JSON from the request and deserialize to the specified type. If the request's content-type is not a known JSON type then an error will be thrown.

public static System.Threading.Tasks.ValueTask<object?> ReadFromJsonAsync (this Microsoft.AspNetCore.Http.HttpRequest request, Type type, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default);
static member ReadFromJsonAsync : Microsoft.AspNetCore.Http.HttpRequest * Type * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<obj>
<Extension()>
Public Function ReadFromJsonAsync (request As HttpRequest, type As Type, options As JsonSerializerOptions, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Object)

Parameters

request
HttpRequest

The request to read from.

type
Type

The type of object to read.

options
JsonSerializerOptions

The serializer options use when deserializing the content.

cancellationToken
CancellationToken

A CancellationToken used to cancel the operation.

Returns

ValueTask<Object>

The task object representing the asynchronous operation.

Applies to

ReadFromJsonAsync<TValue>(HttpRequest, CancellationToken)

Read JSON from the request and deserialize to the specified type. If the request's content-type is not a known JSON type then an error will be thrown.

public static System.Threading.Tasks.ValueTask<TValue?> ReadFromJsonAsync<TValue> (this Microsoft.AspNetCore.Http.HttpRequest request, System.Threading.CancellationToken cancellationToken = default);
static member ReadFromJsonAsync : Microsoft.AspNetCore.Http.HttpRequest * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<'Value>
<Extension()>
Public Function ReadFromJsonAsync(Of TValue) (request As HttpRequest, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of TValue)

Type Parameters

TValue

The type of object to read.

Parameters

request
HttpRequest

The request to read from.

cancellationToken
CancellationToken

A CancellationToken used to cancel the operation.

Returns

ValueTask<TValue>

The task object representing the asynchronous operation.

Applies to

ReadFromJsonAsync<TValue>(HttpRequest, JsonSerializerOptions, CancellationToken)

Read JSON from the request and deserialize to the specified type. If the request's content-type is not a known JSON type then an error will be thrown.

public static System.Threading.Tasks.ValueTask<TValue?> ReadFromJsonAsync<TValue> (this Microsoft.AspNetCore.Http.HttpRequest request, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default);
static member ReadFromJsonAsync : Microsoft.AspNetCore.Http.HttpRequest * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<'Value>
<Extension()>
Public Function ReadFromJsonAsync(Of TValue) (request As HttpRequest, options As JsonSerializerOptions, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of TValue)

Type Parameters

TValue

The type of object to read.

Parameters

request
HttpRequest

The request to read from.

options
JsonSerializerOptions

The serializer options use when deserializing the content.

cancellationToken
CancellationToken

A CancellationToken used to cancel the operation.

Returns

ValueTask<TValue>

The task object representing the asynchronous operation.

Applies to