Method ExtInternet.Json(+ 1 overload)
Overload
Parses content, which must be JSON, and returns the root node. Then you can access JSON elements like var y = (string)r["x"]["y"];
. Downloads content if need.
Uses System.Text.Json.Nodes.JsonNode.Parse.
public static JsonNode Json(this HttpResponseMessage t, bool ignoreError = false)
Parameters
t (HttpResponseMessage) |
ignoreError (bool) |
Returns
Exceptions
HttpRequestException
Failed HTTP request. No exception if ignoreError |
Exception
Exceptions of System.Net.Http.HttpContent.ReadAsByteArrayAsync. |
JsonException
Failed to parse JSON. |
Overload(top)
Parses content, which must be JSON. From it creates/returns an object of type T. Downloads content if need. Uses System.Net.Http.Json.HttpContentJsonExtensions.ReadFromJsonAsync<T>.
public static T Json<T>(this HttpResponseMessage t)
Parameters
Returns
T |
Exceptions
HttpRequestException
Failed HTTP request. |
Exception
Exceptions of ReadFromJsonAsync. |
Type Parameters
T |