예제 #1
0
 /// <summary>Deserializes an object from the JSON content of an HTTP response.</summary>
 /// <param name="response">The response to process.</param>
 /// <param name="options">The JSON serializer options to apply.</param>
 /// <typeparam name="T">The specific type to deserialize.</typeparam>
 /// <returns>The deserialized object.</returns>
 /// <exception cref="JsonException">
 /// When an object of type <typeparamref name="T"/> could not be deserialized from the contents of <paramref name="response"/>.
 /// </exception>
 public static T GetJsonContent <T>(HttpResponseMessage response, JsonSerializerOptions options)
 => AsyncUtils.ResultOf(JsonUtils.GetJsonContentAsync <T>(response, options));
예제 #2
0
 /// <summary>Deserializes an object from the JSON content of an HTTP response.</summary>
 /// <param name="response">The response to process.</param>
 /// <typeparam name="T">The specific type to deserialize.</typeparam>
 /// <returns>The deserialized object.</returns>
 /// <exception cref="JsonException">
 /// When an object of type <typeparamref name="T"/> could not be deserialized from the contents of <paramref name="response"/>.
 /// </exception>
 /// <remarks>The options used match those returned by <see cref="CreateReaderOptions()"/>.</remarks>
 public static T GetJsonContent <T>(HttpResponseMessage response)
 => AsyncUtils.ResultOf(JsonUtils.GetJsonContentAsync <T>(response));