HttpClientJsonExtensions.GetFromJsonAsync Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Överlagringar
| Name | Description |
|---|---|
| GetFromJsonAsync(HttpClient, Uri, Type, JsonSerializerOptions, CancellationToken) |
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd. |
| GetFromJsonAsync(HttpClient, String, Type, JsonSerializerContext, CancellationToken) |
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd. |
| GetFromJsonAsync(HttpClient, Uri, Type, JsonSerializerContext, CancellationToken) |
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd. |
| GetFromJsonAsync(HttpClient, Uri, Type, CancellationToken) |
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd. |
| GetFromJsonAsync(HttpClient, String, Type, CancellationToken) |
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd. |
| GetFromJsonAsync(HttpClient, String, Type, JsonSerializerOptions, CancellationToken) |
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd. |
| GetFromJsonAsync<TValue>(HttpClient, String, CancellationToken) |
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd. |
| GetFromJsonAsync<TValue>(HttpClient, Uri, CancellationToken) |
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd. |
| GetFromJsonAsync<TValue>(HttpClient, String, JsonSerializerOptions, CancellationToken) |
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd. |
| GetFromJsonAsync<TValue>(HttpClient, String, JsonTypeInfo<TValue>, CancellationToken) |
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd. |
| GetFromJsonAsync<TValue>(HttpClient, Uri, JsonSerializerOptions, CancellationToken) |
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd. |
| GetFromJsonAsync<TValue>(HttpClient, Uri, JsonTypeInfo<TValue>, CancellationToken) |
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd. |
GetFromJsonAsync(HttpClient, Uri, Type, JsonSerializerOptions, CancellationToken)
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd.
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
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);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member GetFromJsonAsync : System.Net.Http.HttpClient * Uri * Type * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
static member GetFromJsonAsync : System.Net.Http.HttpClient * Uri * Type * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
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)
Parametrar
- client
- HttpClient
Klienten som användes för att skicka begäran.
- requestUri
- Uri
Den URI som begäran skickas till.
- type
- Type
Typen av objekt som ska deserialiseras till och returneras.
- options
- JsonSerializerOptions
Alternativ för att styra beteendet under deserialiseringen. Standardalternativen är de som anges av Web.
- cancellationToken
- CancellationToken
En annulleringstoken som kan användas av andra objekt eller trådar för att få meddelande om annullering.
Returer
Aktivitetsobjektet som representerar den asynkrona åtgärden.
- Attribut
Undantag
Annulleringstoken avbröts. Det här undantaget lagras i den returnerade aktiviteten.
Gäller för
GetFromJsonAsync(HttpClient, String, Type, JsonSerializerContext, CancellationToken)
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd.
public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, string? requestUri, Type type, System.Text.Json.Serialization.JsonSerializerContext context, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * string * Type * System.Text.Json.Serialization.JsonSerializerContext * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
<Extension()>
Public Function GetFromJsonAsync (client As HttpClient, requestUri As String, type As Type, context As JsonSerializerContext, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Object)
Parametrar
- client
- HttpClient
Klienten som användes för att skicka begäran.
- requestUri
- String
Den URI som begäran skickas till.
- type
- Type
Typen av objekt som ska deserialiseras till och returneras.
- context
- JsonSerializerContext
JsonSerializerContext som används för att styra deserialiseringsbeteendet.
- cancellationToken
- CancellationToken
En annulleringstoken som kan användas av andra objekt eller trådar för att få meddelande om annullering.
Returer
Aktivitetsobjektet som representerar den asynkrona åtgärden.
Undantag
Annulleringstoken avbröts. Det här undantaget lagras i den returnerade aktiviteten.
Gäller för
GetFromJsonAsync(HttpClient, Uri, Type, JsonSerializerContext, CancellationToken)
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd.
public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, Uri? requestUri, Type type, System.Text.Json.Serialization.JsonSerializerContext context, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * Uri * Type * System.Text.Json.Serialization.JsonSerializerContext * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
<Extension()>
Public Function GetFromJsonAsync (client As HttpClient, requestUri As Uri, type As Type, context As JsonSerializerContext, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Object)
Parametrar
- client
- HttpClient
Klienten som användes för att skicka begäran.
- requestUri
- Uri
Den URI som begäran skickas till.
- type
- Type
Typen av objekt som ska deserialiseras till och returneras.
- context
- JsonSerializerContext
JsonSerializerContext som används för att styra deserialiseringsbeteendet.
- cancellationToken
- CancellationToken
En annulleringstoken som kan användas av andra objekt eller trådar för att få meddelande om annullering.
Returer
Aktivitetsobjektet som representerar den asynkrona åtgärden.
Undantag
Annulleringstoken avbröts. Det här undantaget lagras i den returnerade aktiviteten.
Gäller för
GetFromJsonAsync(HttpClient, Uri, Type, CancellationToken)
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd.
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, Uri? requestUri, Type type, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, Uri? requestUri, Type type, System.Threading.CancellationToken cancellationToken = default);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, Uri? requestUri, Type type, System.Threading.CancellationToken cancellationToken = default);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member GetFromJsonAsync : System.Net.Http.HttpClient * Uri * Type * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
static member GetFromJsonAsync : System.Net.Http.HttpClient * Uri * Type * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
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)
Parametrar
- client
- HttpClient
Klienten som användes för att skicka begäran.
- requestUri
- Uri
Den URI som begäran skickas till.
- type
- Type
Typen av objekt som ska deserialiseras till och returneras.
- cancellationToken
- CancellationToken
En annulleringstoken som kan användas av andra objekt eller trådar för att få meddelande om annullering.
Returer
Aktivitetsobjektet som representerar den asynkrona åtgärden.
- Attribut
Undantag
Annulleringstoken avbröts. Det här undantaget lagras i den returnerade aktiviteten.
Kommentarer
Den här metoden använder JsonSerializerDefaults.Web alternativ för deserialisering, medan JsonSerializer deserialiseringsmetoder inte gör det som standard.
Gäller för
GetFromJsonAsync(HttpClient, String, Type, CancellationToken)
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd.
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, string? requestUri, Type type, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, string? requestUri, Type type, System.Threading.CancellationToken cancellationToken = default);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, string? requestUri, Type type, System.Threading.CancellationToken cancellationToken = default);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member GetFromJsonAsync : System.Net.Http.HttpClient * string * Type * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
static member GetFromJsonAsync : System.Net.Http.HttpClient * string * Type * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
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)
Parametrar
- client
- HttpClient
Klienten som användes för att skicka begäran.
- requestUri
- String
Den URI som begäran skickas till.
- type
- Type
Typen av objekt som ska deserialiseras till och returneras.
- cancellationToken
- CancellationToken
En annulleringstoken som kan användas av andra objekt eller trådar för att få meddelande om annullering.
Returer
Aktivitetsobjektet som representerar den asynkrona åtgärden.
- Attribut
Undantag
Annulleringstoken avbröts. Det här undantaget lagras i den returnerade aktiviteten.
Kommentarer
Den här metoden använder JsonSerializerDefaults.Web alternativ för deserialisering, medan JsonSerializer deserialiseringsmetoder inte gör det som standard.
Gäller för
GetFromJsonAsync(HttpClient, String, Type, JsonSerializerOptions, CancellationToken)
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd.
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
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);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member GetFromJsonAsync : System.Net.Http.HttpClient * string * Type * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
static member GetFromJsonAsync : System.Net.Http.HttpClient * string * Type * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
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)
Parametrar
- client
- HttpClient
Klienten som användes för att skicka begäran.
- requestUri
- String
Den URI som begäran skickas till.
- type
- Type
Typen av objekt som ska deserialiseras till och returneras.
- options
- JsonSerializerOptions
Alternativ för att styra beteendet under deserialiseringen. Standardalternativen är de som anges av Web.
- cancellationToken
- CancellationToken
En annulleringstoken som kan användas av andra objekt eller trådar för att få meddelande om annullering.
Returer
Aktivitetsobjektet som representerar den asynkrona åtgärden.
- Attribut
Undantag
Annulleringstoken avbröts. Det här undantaget lagras i den returnerade aktiviteten.
Gäller för
GetFromJsonAsync<TValue>(HttpClient, String, CancellationToken)
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd.
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, string? requestUri, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, string? requestUri, System.Threading.CancellationToken cancellationToken = default);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, string? requestUri, System.Threading.CancellationToken cancellationToken = default);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member GetFromJsonAsync : System.Net.Http.HttpClient * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Value>
static member GetFromJsonAsync : System.Net.Http.HttpClient * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Value>
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
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)
Typparametrar
- TValue
Måltypen som deserialisera till.
Parametrar
- client
- HttpClient
Klienten som användes för att skicka begäran.
- requestUri
- String
Den URI som begäran skickas till.
- cancellationToken
- CancellationToken
En annulleringstoken som kan användas av andra objekt eller trådar för att få meddelande om annullering.
Returer
Aktivitetsobjektet som representerar den asynkrona åtgärden.
- Attribut
Undantag
Annulleringstoken avbröts. Det här undantaget lagras i den returnerade aktiviteten.
Kommentarer
Den här metoden använder JsonSerializerDefaults.Web alternativ för deserialisering, medan JsonSerializer deserialiseringsmetoder inte gör det som standard.
Gäller för
GetFromJsonAsync<TValue>(HttpClient, Uri, CancellationToken)
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd.
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, Uri? requestUri, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, Uri? requestUri, System.Threading.CancellationToken cancellationToken = default);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, Uri? requestUri, System.Threading.CancellationToken cancellationToken = default);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member GetFromJsonAsync : System.Net.Http.HttpClient * Uri * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Value>
static member GetFromJsonAsync : System.Net.Http.HttpClient * Uri * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Value>
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
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)
Typparametrar
- TValue
Måltypen som deserialisera till.
Parametrar
- client
- HttpClient
Klienten som användes för att skicka begäran.
- requestUri
- Uri
Den URI som begäran skickas till.
- cancellationToken
- CancellationToken
En annulleringstoken som kan användas av andra objekt eller trådar för att få meddelande om annullering.
Returer
Aktivitetsobjektet som representerar den asynkrona åtgärden.
- Attribut
Undantag
Annulleringstoken avbröts. Det här undantaget lagras i den returnerade aktiviteten.
Kommentarer
Den här metoden använder JsonSerializerDefaults.Web alternativ för deserialisering, medan JsonSerializer deserialiseringsmetoder inte gör det som standard.
Gäller för
GetFromJsonAsync<TValue>(HttpClient, String, JsonSerializerOptions, CancellationToken)
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd.
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
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);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member GetFromJsonAsync : System.Net.Http.HttpClient * string * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Value>
static member GetFromJsonAsync : System.Net.Http.HttpClient * string * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Value>
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
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)
Typparametrar
- TValue
Måltypen som deserialisera till.
Parametrar
- client
- HttpClient
Klienten som användes för att skicka begäran.
- requestUri
- String
Den URI som begäran skickas till.
- options
- JsonSerializerOptions
Alternativ för att styra beteendet under deserialiseringen. Standardalternativen är de som anges av Web.
- cancellationToken
- CancellationToken
En annulleringstoken som kan användas av andra objekt eller trådar för att få meddelande om annullering.
Returer
Aktivitetsobjektet som representerar den asynkrona åtgärden.
- Attribut
Undantag
Annulleringstoken avbröts. Det här undantaget lagras i den returnerade aktiviteten.
Gäller för
GetFromJsonAsync<TValue>(HttpClient, String, JsonTypeInfo<TValue>, CancellationToken)
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd.
public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, string? requestUri, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * string * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Value>
<Extension()>
Public Function GetFromJsonAsync(Of TValue) (client As HttpClient, requestUri As String, jsonTypeInfo As JsonTypeInfo(Of TValue), Optional cancellationToken As CancellationToken = Nothing) As Task(Of TValue)
Typparametrar
- TValue
Måltypen som deserialisera till.
Parametrar
- client
- HttpClient
Klienten som användes för att skicka begäran.
- requestUri
- String
Den URI som begäran skickas till.
- jsonTypeInfo
- JsonTypeInfo<TValue>
JsonTypeInfo som används för att styra deserialiseringsbeteendet.
- cancellationToken
- CancellationToken
En annulleringstoken som kan användas av andra objekt eller trådar för att få meddelande om annullering.
Returer
Aktivitetsobjektet som representerar den asynkrona åtgärden.
Undantag
Annulleringstoken avbröts. Det här undantaget lagras i den returnerade aktiviteten.
Gäller för
GetFromJsonAsync<TValue>(HttpClient, Uri, JsonSerializerOptions, CancellationToken)
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd.
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
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);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member GetFromJsonAsync : System.Net.Http.HttpClient * Uri * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Value>
static member GetFromJsonAsync : System.Net.Http.HttpClient * Uri * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Value>
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
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)
Typparametrar
- TValue
Måltypen som deserialisera till.
Parametrar
- client
- HttpClient
Klienten som användes för att skicka begäran.
- requestUri
- Uri
Den URI som begäran skickas till.
- options
- JsonSerializerOptions
Alternativ för att styra beteendet under deserialiseringen. Standardalternativen är de som anges av Web.
- cancellationToken
- CancellationToken
En annulleringstoken som kan användas av andra objekt eller trådar för att få meddelande om annullering.
Returer
Aktivitetsobjektet som representerar den asynkrona åtgärden.
- Attribut
Undantag
Annulleringstoken avbröts. Det här undantaget lagras i den returnerade aktiviteten.
Gäller för
GetFromJsonAsync<TValue>(HttpClient, Uri, JsonTypeInfo<TValue>, CancellationToken)
Skickar en GET-begäran till den angivna URI:n och returnerar värdet som är resultatet av att deserialisera svarstexten som JSON i en asynkron åtgärd.
public static System.Threading.Tasks.Task<TValue?> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, Uri? requestUri, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member GetFromJsonAsync : System.Net.Http.HttpClient * Uri * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Value>
<Extension()>
Public Function GetFromJsonAsync(Of TValue) (client As HttpClient, requestUri As Uri, jsonTypeInfo As JsonTypeInfo(Of TValue), Optional cancellationToken As CancellationToken = Nothing) As Task(Of TValue)
Typparametrar
- TValue
Måltypen som deserialisera till.
Parametrar
- client
- HttpClient
Klienten som användes för att skicka begäran.
- requestUri
- Uri
Den URI som begäran skickas till.
- jsonTypeInfo
- JsonTypeInfo<TValue>
JsonTypeInfo som används för att styra deserialiseringsbeteendet.
- cancellationToken
- CancellationToken
En annulleringstoken som kan användas av andra objekt eller trådar för att få meddelande om annullering.
Returer
Aktivitetsobjektet som representerar den asynkrona åtgärden.
Undantag
Annulleringstoken avbröts. Det här undantaget lagras i den returnerade aktiviteten.