HttpClientJsonExtensions.GetFromJsonAsync Método

Definição

Sobrecargas

GetFromJsonAsync(HttpClient, String, Type, CancellationToken)

Envia uma solicitação GET para o URI especificado e retorna o valor resultante da desserialização do corpo da resposta como um JSON em uma operação assíncrona.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

GetFromJsonAsync(HttpClient, Uri, Type, CancellationToken)

Envia uma solicitação GET para o URI especificado e retorna o valor resultante da desserialização do corpo da resposta como um JSON em uma operação assíncrona.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

GetFromJsonAsync(HttpClient, String, Type, JsonSerializerOptions, CancellationToken)

Envia uma solicitação GET para o URI especificado e retorna o valor resultante da desserialização do corpo da resposta como um JSON em uma operação assíncrona.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

GetFromJsonAsync(HttpClient, Uri, Type, JsonSerializerOptions, CancellationToken)

Envia uma solicitação GET para o URI especificado e retorna o valor resultante da desserialização do corpo da resposta como um JSON em uma operação assíncrona.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

GetFromJsonAsync<TValue>(HttpClient, String, CancellationToken)

Envia uma solicitação GET para o URI especificado e retorna o valor resultante da desserialização do corpo da resposta como um JSON em uma operação assíncrona.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

GetFromJsonAsync<TValue>(HttpClient, Uri, CancellationToken)

Envia uma solicitação GET para o URI especificado e retorna o valor resultante da desserialização do corpo da resposta como um JSON em uma operação assíncrona.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

GetFromJsonAsync<TValue>(HttpClient, String, JsonSerializerOptions, CancellationToken)

Envia uma solicitação GET para o URI especificado e retorna o valor resultante da desserialização do corpo da resposta como um JSON em uma operação assíncrona.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

GetFromJsonAsync<TValue>(HttpClient, Uri, JsonSerializerOptions, CancellationToken)

Envia uma solicitação GET para o URI especificado e retorna o valor resultante da desserialização do corpo da resposta como um JSON em uma operação assíncrona.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

GetFromJsonAsync(HttpClient, String, Type, CancellationToken)

Envia uma solicitação GET para o URI especificado e retorna o valor resultante da desserialização do corpo da resposta como um JSON em uma operação assíncrona.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

public static System.Threading.Tasks.Task<object?> GetFromJsonAsync (this System.Net.Http.HttpClient client, string? requestUri, Type type, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * string * Type * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
<Extension()>
Public Function GetFromJsonAsync (client As HttpClient, requestUri As String, type As Type, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Object)

Parâmetros

client
HttpClient

O cliente usado para enviar a solicitação.The client used to send the request.

requestUri
String

O URI ao qual a solicitação é enviada.The Uri the request is sent to.

type
Type

O tipo de objeto a ser desserializado e retornado.The type of the object to deserialize to and return.

cancellationToken
CancellationToken

Um token de cancelamento que pode ser usado por outros objetos ou threads para receber um aviso de cancelamento.A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Retornos

Task<Object>

O objeto de tarefa que representa a operação assíncrona.The task object representing the asynchronous operation.

Comentários

Esse método usa JsonSerializerDefaults.Web opções para desserialização, enquanto JsonSerializer os métodos de desserialização não, por padrão.This method uses JsonSerializerDefaults.Web options for deserialization, whereas JsonSerializer deserialization methods do not, by default.

Aplica-se a

GetFromJsonAsync(HttpClient, Uri, Type, CancellationToken)

Envia uma solicitação GET para o URI especificado e retorna o valor resultante da desserialização do corpo da resposta como um JSON em uma operação assíncrona.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

public static System.Threading.Tasks.Task<object?> GetFromJsonAsync (this System.Net.Http.HttpClient client, Uri? requestUri, Type type, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * Uri * Type * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
<Extension()>
Public Function GetFromJsonAsync (client As HttpClient, requestUri As Uri, type As Type, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Object)

Parâmetros

client
HttpClient

O cliente usado para enviar a solicitação.The client used to send the request.

requestUri
Uri

O URI ao qual a solicitação é enviada.The Uri the request is sent to.

type
Type

O tipo de objeto a ser desserializado e retornado.The type of the object to deserialize to and return.

cancellationToken
CancellationToken

Um token de cancelamento que pode ser usado por outros objetos ou threads para receber um aviso de cancelamento.A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Retornos

Task<Object>

O objeto de tarefa que representa a operação assíncrona.The task object representing the asynchronous operation.

Comentários

Esse método usa JsonSerializerDefaults.Web opções para desserialização, enquanto JsonSerializer os métodos de desserialização não, por padrão.This method uses JsonSerializerDefaults.Web options for deserialization, whereas JsonSerializer deserialization methods do not, by default.

Aplica-se a

GetFromJsonAsync(HttpClient, String, Type, JsonSerializerOptions, CancellationToken)

Envia uma solicitação GET para o URI especificado e retorna o valor resultante da desserialização do corpo da resposta como um JSON em uma operação assíncrona.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

public static System.Threading.Tasks.Task<object?> GetFromJsonAsync (this System.Net.Http.HttpClient client, string? requestUri, Type type, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * string * Type * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
<Extension()>
Public Function GetFromJsonAsync (client As HttpClient, requestUri As String, type As Type, options As JsonSerializerOptions, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Object)

Parâmetros

client
HttpClient

O cliente usado para enviar a solicitação.The client used to send the request.

requestUri
String

O URI ao qual a solicitação é enviada.The Uri the request is sent to.

type
Type

O tipo de objeto a ser desserializado e retornado.The type of the object to deserialize to and return.

options
JsonSerializerOptions

Opções para controlar o comportamento durante a desserialização.Options to control the behavior during deserialization. As opções padrão são as especificadas por Web.The default options are those specified by Web.

cancellationToken
CancellationToken

Um token de cancelamento que pode ser usado por outros objetos ou threads para receber um aviso de cancelamento.A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Retornos

Task<Object>

O objeto de tarefa que representa a operação assíncrona.The task object representing the asynchronous operation.

Aplica-se a

GetFromJsonAsync(HttpClient, Uri, Type, JsonSerializerOptions, CancellationToken)

Envia uma solicitação GET para o URI especificado e retorna o valor resultante da desserialização do corpo da resposta como um JSON em uma operação assíncrona.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

public static System.Threading.Tasks.Task<object?> GetFromJsonAsync (this System.Net.Http.HttpClient client, Uri? requestUri, Type type, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * Uri * Type * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
<Extension()>
Public Function GetFromJsonAsync (client As HttpClient, requestUri As Uri, type As Type, options As JsonSerializerOptions, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Object)

Parâmetros

client
HttpClient

O cliente usado para enviar a solicitação.The client used to send the request.

requestUri
Uri

O URI ao qual a solicitação é enviada.The Uri the request is sent to.

type
Type

O tipo de objeto a ser desserializado e retornado.The type of the object to deserialize to and return.

options
JsonSerializerOptions

Opções para controlar o comportamento durante a desserialização.Options to control the behavior during deserialization. As opções padrão são as especificadas por Web.The default options are those specified by Web.

cancellationToken
CancellationToken

Um token de cancelamento que pode ser usado por outros objetos ou threads para receber um aviso de cancelamento.A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Retornos

Task<Object>

O objeto de tarefa que representa a operação assíncrona.The task object representing the asynchronous operation.

Aplica-se a

GetFromJsonAsync<TValue>(HttpClient, String, CancellationToken)

Envia uma solicitação GET para o URI especificado e retorna o valor resultante da desserialização do corpo da resposta como um JSON em uma operação assíncrona.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue> (this System.Net.Http.HttpClient client, string? requestUri, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Value>
<Extension()>
Public Function GetFromJsonAsync(Of TValue) (client As HttpClient, requestUri As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TValue)

Parâmetros de tipo

TValue

O tipo de destino para desserializar.The target type to deserialize to.

Parâmetros

client
HttpClient

O cliente usado para enviar a solicitação.The client used to send the request.

requestUri
String

O URI ao qual a solicitação é enviada.The Uri the request is sent to.

cancellationToken
CancellationToken

Um token de cancelamento que pode ser usado por outros objetos ou threads para receber um aviso de cancelamento.A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Retornos

Task<TValue>

O objeto de tarefa que representa a operação assíncrona.The task object representing the asynchronous operation.

Comentários

Esse método usa JsonSerializerDefaults.Web opções para desserialização, enquanto JsonSerializer os métodos de desserialização não, por padrão.This method uses JsonSerializerDefaults.Web options for deserialization, whereas JsonSerializer deserialization methods do not, by default.

Aplica-se a

GetFromJsonAsync<TValue>(HttpClient, Uri, CancellationToken)

Envia uma solicitação GET para o URI especificado e retorna o valor resultante da desserialização do corpo da resposta como um JSON em uma operação assíncrona.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue> (this System.Net.Http.HttpClient client, Uri? requestUri, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * Uri * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Value>
<Extension()>
Public Function GetFromJsonAsync(Of TValue) (client As HttpClient, requestUri As Uri, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TValue)

Parâmetros de tipo

TValue

O tipo de destino para desserializar.The target type to deserialize to.

Parâmetros

client
HttpClient

O cliente usado para enviar a solicitação.The client used to send the request.

requestUri
Uri

O URI ao qual a solicitação é enviada.The Uri the request is sent to.

cancellationToken
CancellationToken

Um token de cancelamento que pode ser usado por outros objetos ou threads para receber um aviso de cancelamento.A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Retornos

Task<TValue>

O objeto de tarefa que representa a operação assíncrona.The task object representing the asynchronous operation.

Comentários

Esse método usa JsonSerializerDefaults.Web opções para desserialização, enquanto JsonSerializer os métodos de desserialização não, por padrão.This method uses JsonSerializerDefaults.Web options for deserialization, whereas JsonSerializer deserialization methods do not, by default.

Aplica-se a

GetFromJsonAsync<TValue>(HttpClient, String, JsonSerializerOptions, CancellationToken)

Envia uma solicitação GET para o URI especificado e retorna o valor resultante da desserialização do corpo da resposta como um JSON em uma operação assíncrona.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue> (this System.Net.Http.HttpClient client, string? requestUri, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * string * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Value>
<Extension()>
Public Function GetFromJsonAsync(Of TValue) (client As HttpClient, requestUri As String, options As JsonSerializerOptions, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TValue)

Parâmetros de tipo

TValue

O tipo de destino para desserializar.The target type to deserialize to.

Parâmetros

client
HttpClient

O cliente usado para enviar a solicitação.The client used to send the request.

requestUri
String

O URI ao qual a solicitação é enviada.The Uri the request is sent to.

options
JsonSerializerOptions

Opções para controlar o comportamento durante a desserialização.Options to control the behavior during deserialization. As opções padrão são as especificadas por Web.The default options are those specified by Web.

cancellationToken
CancellationToken

Um token de cancelamento que pode ser usado por outros objetos ou threads para receber um aviso de cancelamento.A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Retornos

Task<TValue>

O objeto de tarefa que representa a operação assíncrona.The task object representing the asynchronous operation.

Aplica-se a

GetFromJsonAsync<TValue>(HttpClient, Uri, JsonSerializerOptions, CancellationToken)

Envia uma solicitação GET para o URI especificado e retorna o valor resultante da desserialização do corpo da resposta como um JSON em uma operação assíncrona.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue> (this System.Net.Http.HttpClient client, Uri? requestUri, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * Uri * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Value>
<Extension()>
Public Function GetFromJsonAsync(Of TValue) (client As HttpClient, requestUri As Uri, options As JsonSerializerOptions, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TValue)

Parâmetros de tipo

TValue

O tipo de destino para desserializar.The target type to deserialize to.

Parâmetros

client
HttpClient

O cliente usado para enviar a solicitação.The client used to send the request.

requestUri
Uri

O URI ao qual a solicitação é enviada.The Uri the request is sent to.

options
JsonSerializerOptions

Opções para controlar o comportamento durante a desserialização.Options to control the behavior during deserialization. As opções padrão são as especificadas por Web.The default options are those specified by Web.

cancellationToken
CancellationToken

Um token de cancelamento que pode ser usado por outros objetos ou threads para receber um aviso de cancelamento.A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Retornos

Task<TValue>

O objeto de tarefa que representa a operação assíncrona.The task object representing the asynchronous operation.

Aplica-se a