HttpRequestJsonExtensions.ReadFromJsonAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
ReadFromJsonAsync(HttpRequest, JsonTypeInfo, CancellationToken) |
Read JSON from the request and deserialize to object 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. |
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(HttpRequest, Type, JsonSerializerContext, 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<TValue>(HttpRequest, JsonTypeInfo<TValue>, 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, JsonTypeInfo, CancellationToken)
- Source:
- HttpRequestJsonExtensions.cs
Read JSON from the request and deserialize to object 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, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member ReadFromJsonAsync : Microsoft.AspNetCore.Http.HttpRequest * System.Text.Json.Serialization.Metadata.JsonTypeInfo * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<obj>
<Extension()>
Public Function ReadFromJsonAsync (request As HttpRequest, jsonTypeInfo As JsonTypeInfo, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Object)
Parameters
- request
- HttpRequest
The request to read from.
- jsonTypeInfo
- JsonTypeInfo
Metadata about the type to convert.
- cancellationToken
- CancellationToken
A CancellationToken used to cancel the operation.
Returns
The deserialized value.
Applies to
ReadFromJsonAsync(HttpRequest, Type, CancellationToken)
- Source:
- HttpRequestJsonExtensions.cs
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
The task object representing the asynchronous operation.
Applies to
ReadFromJsonAsync(HttpRequest, Type, JsonSerializerOptions, CancellationToken)
- Source:
- HttpRequestJsonExtensions.cs
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
The task object representing the asynchronous operation.
Applies to
ReadFromJsonAsync(HttpRequest, Type, JsonSerializerContext, CancellationToken)
- Source:
- HttpRequestJsonExtensions.cs
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.Serialization.JsonSerializerContext context, System.Threading.CancellationToken cancellationToken = default);
static member ReadFromJsonAsync : Microsoft.AspNetCore.Http.HttpRequest * Type * System.Text.Json.Serialization.JsonSerializerContext * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<obj>
<Extension()>
Public Function ReadFromJsonAsync (request As HttpRequest, type As Type, context As JsonSerializerContext, 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.
- context
- JsonSerializerContext
A metadata provider for serializable types.
- cancellationToken
- CancellationToken
A CancellationToken used to cancel the operation.
Returns
The deserialized value.
Applies to
ReadFromJsonAsync<TValue>(HttpRequest, CancellationToken)
- Source:
- HttpRequestJsonExtensions.cs
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
The task object representing the asynchronous operation.
Applies to
ReadFromJsonAsync<TValue>(HttpRequest, JsonSerializerOptions, CancellationToken)
- Source:
- HttpRequestJsonExtensions.cs
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 to use when deserializing the content.
- cancellationToken
- CancellationToken
A CancellationToken used to cancel the operation.
Returns
The task object representing the asynchronous operation.
Applies to
ReadFromJsonAsync<TValue>(HttpRequest, JsonTypeInfo<TValue>, CancellationToken)
- Source:
- HttpRequestJsonExtensions.cs
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.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member ReadFromJsonAsync : Microsoft.AspNetCore.Http.HttpRequest * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<'Value>
<Extension()>
Public Function ReadFromJsonAsync(Of TValue) (request As HttpRequest, jsonTypeInfo As JsonTypeInfo(Of TValue), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of TValue)
Type Parameters
- TValue
Parameters
- request
- HttpRequest
The request to read from.
- jsonTypeInfo
- JsonTypeInfo<TValue>
Metadata about the type to convert.
- cancellationToken
- CancellationToken
A CancellationToken used to cancel the operation.
Returns
The deserialized value.