HttpContentJsonExtensions.ReadFromJsonAsync Method
Definition
Overloads
ReadFromJsonAsync(HttpContent, Type, JsonSerializerOptions, CancellationToken) |
Reads the HTTP content and returns the value that results from deserializing the content as JSON in an asynchronous operation. |
ReadFromJsonAsync<T>(HttpContent, JsonSerializerOptions, CancellationToken) |
Reads the HTTP content and returns the value that results from deserializing the content as JSON in an asynchronous operation. |
ReadFromJsonAsync(HttpContent, Type, JsonSerializerOptions, CancellationToken)
Reads the HTTP content and returns the value that results from deserializing the content as JSON in an asynchronous operation.
public static System.Threading.Tasks.Task<object>? ReadFromJsonAsync (this System.Net.Http.HttpContent content, Type type, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
static member ReadFromJsonAsync : System.Net.Http.HttpContent * Type * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
<Extension()>
Public Function ReadFromJsonAsync (content As HttpContent, type As Type, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Object)
Parameters
- content
- HttpContent
The content to read from.
- type
- Type
The type of the object to deserialize to and return.
- options
- JsonSerializerOptions
Options to control the behavior during deserialization. The default options are those specified by Web.
- cancellationToken
- CancellationToken
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
The task object representing the asynchronous operation.
Applies to
ReadFromJsonAsync<T>(HttpContent, JsonSerializerOptions, CancellationToken)
Reads the HTTP content and returns the value that results from deserializing the content as JSON in an asynchronous operation.
public static System.Threading.Tasks.Task<T>? ReadFromJsonAsync<T> (this System.Net.Http.HttpContent? content, System.Text.Json.JsonSerializerOptions options = default, System.Threading.CancellationToken cancellationToken = default);
static member ReadFromJsonAsync : System.Net.Http.HttpContent * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>
<Extension()>
Public Function ReadFromJsonAsync(Of T) (content As HttpContent, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of T)
Type Parameters
- T
The target type to deserialize to.
Parameters
- content
- HttpContent
The content to read from.
- options
- JsonSerializerOptions
Options to control the behavior during deserialization. The default options are those specified by Web.
- cancellationToken
- CancellationToken
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
- Task<T>
The task object representing the asynchronous operation.