HttpClientJsonExtensions.GetFromJsonAsync Metoda
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Přetížení
| Name | Description |
|---|---|
| GetFromJsonAsync(HttpClient, Uri, Type, JsonSerializerOptions, CancellationToken) |
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci. |
| GetFromJsonAsync(HttpClient, String, Type, JsonSerializerContext, CancellationToken) |
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci. |
| GetFromJsonAsync(HttpClient, Uri, Type, JsonSerializerContext, CancellationToken) |
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci. |
| GetFromJsonAsync(HttpClient, Uri, Type, CancellationToken) |
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci. |
| GetFromJsonAsync(HttpClient, String, Type, CancellationToken) |
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci. |
| GetFromJsonAsync(HttpClient, String, Type, JsonSerializerOptions, CancellationToken) |
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci. |
| GetFromJsonAsync<TValue>(HttpClient, String, CancellationToken) |
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci. |
| GetFromJsonAsync<TValue>(HttpClient, Uri, CancellationToken) |
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci. |
| GetFromJsonAsync<TValue>(HttpClient, String, JsonSerializerOptions, CancellationToken) |
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci. |
| GetFromJsonAsync<TValue>(HttpClient, String, JsonTypeInfo<TValue>, CancellationToken) |
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci. |
| GetFromJsonAsync<TValue>(HttpClient, Uri, JsonSerializerOptions, CancellationToken) |
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci. |
| GetFromJsonAsync<TValue>(HttpClient, Uri, JsonTypeInfo<TValue>, CancellationToken) |
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci. |
GetFromJsonAsync(HttpClient, Uri, Type, JsonSerializerOptions, CancellationToken)
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci.
[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)
Parametry
- client
- HttpClient
Klient použitý k odeslání požadavku.
- requestUri
- Uri
Identifikátor URI, na který se požadavek odešle.
- type
- Type
Typ objektu k deserializaci a vrácení.
- options
- JsonSerializerOptions
Možnosti řízení chování při deserializaci Výchozí možnosti jsou určené parametrem Web.
- cancellationToken
- CancellationToken
Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.
Návraty
Objekt úkolu představující asynchronní operaci.
- Atributy
Výjimky
Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.
Platí pro
GetFromJsonAsync(HttpClient, String, Type, JsonSerializerContext, CancellationToken)
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci.
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)
Parametry
- client
- HttpClient
Klient použitý k odeslání požadavku.
- requestUri
- String
Identifikátor URI, na který se požadavek odešle.
- type
- Type
Typ objektu k deserializaci a vrácení.
- context
- JsonSerializerContext
JsonSerializerContext sloužící k řízení chování deserializace.
- cancellationToken
- CancellationToken
Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.
Návraty
Objekt úkolu představující asynchronní operaci.
Výjimky
Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.
Platí pro
GetFromJsonAsync(HttpClient, Uri, Type, JsonSerializerContext, CancellationToken)
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci.
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)
Parametry
- client
- HttpClient
Klient použitý k odeslání požadavku.
- requestUri
- Uri
Identifikátor URI, na který se požadavek odešle.
- type
- Type
Typ objektu k deserializaci a vrácení.
- context
- JsonSerializerContext
JsonSerializerContext sloužící k řízení chování deserializace.
- cancellationToken
- CancellationToken
Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.
Návraty
Objekt úkolu představující asynchronní operaci.
Výjimky
Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.
Platí pro
GetFromJsonAsync(HttpClient, Uri, Type, CancellationToken)
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci.
[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)
Parametry
- client
- HttpClient
Klient použitý k odeslání požadavku.
- requestUri
- Uri
Identifikátor URI, na který se požadavek odešle.
- type
- Type
Typ objektu k deserializaci a vrácení.
- cancellationToken
- CancellationToken
Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.
Návraty
Objekt úkolu představující asynchronní operaci.
- Atributy
Výjimky
Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.
Poznámky
Tato metoda používá JsonSerializerDefaults.Web možnosti pro deserializaci, zatímco JsonSerializer metody deserializace ve výchozím nastavení ne.
Platí pro
GetFromJsonAsync(HttpClient, String, Type, CancellationToken)
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci.
[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)
Parametry
- client
- HttpClient
Klient použitý k odeslání požadavku.
- requestUri
- String
Identifikátor URI, na který se požadavek odešle.
- type
- Type
Typ objektu k deserializaci a vrácení.
- cancellationToken
- CancellationToken
Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.
Návraty
Objekt úkolu představující asynchronní operaci.
- Atributy
Výjimky
Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.
Poznámky
Tato metoda používá JsonSerializerDefaults.Web možnosti pro deserializaci, zatímco JsonSerializer metody deserializace ve výchozím nastavení ne.
Platí pro
GetFromJsonAsync(HttpClient, String, Type, JsonSerializerOptions, CancellationToken)
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci.
[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)
Parametry
- client
- HttpClient
Klient použitý k odeslání požadavku.
- requestUri
- String
Identifikátor URI, na který se požadavek odešle.
- type
- Type
Typ objektu k deserializaci a vrácení.
- options
- JsonSerializerOptions
Možnosti řízení chování při deserializaci Výchozí možnosti jsou určené parametrem Web.
- cancellationToken
- CancellationToken
Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.
Návraty
Objekt úkolu představující asynchronní operaci.
- Atributy
Výjimky
Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.
Platí pro
GetFromJsonAsync<TValue>(HttpClient, String, CancellationToken)
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci.
[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)
Parametry typu
- TValue
Cílový typ, na který se má deserializovat.
Parametry
- client
- HttpClient
Klient použitý k odeslání požadavku.
- requestUri
- String
Identifikátor URI, na který se požadavek odešle.
- cancellationToken
- CancellationToken
Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.
Návraty
Objekt úkolu představující asynchronní operaci.
- Atributy
Výjimky
Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.
Poznámky
Tato metoda používá JsonSerializerDefaults.Web možnosti pro deserializaci, zatímco JsonSerializer metody deserializace ve výchozím nastavení ne.
Platí pro
GetFromJsonAsync<TValue>(HttpClient, Uri, CancellationToken)
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci.
[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)
Parametry typu
- TValue
Cílový typ, na který se má deserializovat.
Parametry
- client
- HttpClient
Klient použitý k odeslání požadavku.
- requestUri
- Uri
Identifikátor URI, na který se požadavek odešle.
- cancellationToken
- CancellationToken
Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.
Návraty
Objekt úkolu představující asynchronní operaci.
- Atributy
Výjimky
Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.
Poznámky
Tato metoda používá JsonSerializerDefaults.Web možnosti pro deserializaci, zatímco JsonSerializer metody deserializace ve výchozím nastavení ne.
Platí pro
GetFromJsonAsync<TValue>(HttpClient, String, JsonSerializerOptions, CancellationToken)
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci.
[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)
Parametry typu
- TValue
Cílový typ, na který se má deserializovat.
Parametry
- client
- HttpClient
Klient použitý k odeslání požadavku.
- requestUri
- String
Identifikátor URI, na který se požadavek odešle.
- options
- JsonSerializerOptions
Možnosti řízení chování při deserializaci Výchozí možnosti jsou určené parametrem Web.
- cancellationToken
- CancellationToken
Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.
Návraty
Objekt úkolu představující asynchronní operaci.
- Atributy
Výjimky
Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.
Platí pro
GetFromJsonAsync<TValue>(HttpClient, String, JsonTypeInfo<TValue>, CancellationToken)
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci.
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)
Parametry typu
- TValue
Cílový typ, na který se má deserializovat.
Parametry
- client
- HttpClient
Klient použitý k odeslání požadavku.
- requestUri
- String
Identifikátor URI, na který se požadavek odešle.
- jsonTypeInfo
- JsonTypeInfo<TValue>
JsonTypeInfo sloužící k řízení chování deserializace.
- cancellationToken
- CancellationToken
Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.
Návraty
Objekt úkolu představující asynchronní operaci.
Výjimky
Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.
Platí pro
GetFromJsonAsync<TValue>(HttpClient, Uri, JsonSerializerOptions, CancellationToken)
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci.
[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)
Parametry typu
- TValue
Cílový typ, na který se má deserializovat.
Parametry
- client
- HttpClient
Klient použitý k odeslání požadavku.
- requestUri
- Uri
Identifikátor URI, na který se požadavek odešle.
- options
- JsonSerializerOptions
Možnosti řízení chování při deserializaci Výchozí možnosti jsou určené parametrem Web.
- cancellationToken
- CancellationToken
Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.
Návraty
Objekt úkolu představující asynchronní operaci.
- Atributy
Výjimky
Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.
Platí pro
GetFromJsonAsync<TValue>(HttpClient, Uri, JsonTypeInfo<TValue>, CancellationToken)
Odešle požadavek GET na zadaný identifikátor URI a vrátí hodnotu, která je výsledkem deserializace textu odpovědi jako JSON v asynchronní operaci.
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)
Parametry typu
- TValue
Cílový typ, na který se má deserializovat.
Parametry
- client
- HttpClient
Klient použitý k odeslání požadavku.
- requestUri
- Uri
Identifikátor URI, na který se požadavek odešle.
- jsonTypeInfo
- JsonTypeInfo<TValue>
JsonTypeInfo sloužící k řízení chování deserializace.
- cancellationToken
- CancellationToken
Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.
Návraty
Objekt úkolu představující asynchronní operaci.
Výjimky
Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.