C#C
C#3y ago
adoma

❔ Why is my deserialize not working here:

> private static void SearchGame()
> {
> Write("Title: ");
> string title = ReadLine();
>
> HttpResponseMessage response = null;
>
> response = httpClient.GetAsync($"games/{title}").Result;
>
> response.EnsureSuccessStatusCode();
>
> var content = response.Content.ReadAsStringAsync().Result;
> var games = JsonSerializer.Deserialize<List<GameDTO>>(content);
>
> foreach (var game in games)
> {
> WriteLine($"Id: {game.Id}");
> WriteLine($"Title: {game.Title}");
> WriteLine($"Description: {game.Description}");
> WriteLine($"Release Date: {game.ReleaseDate}");
> WriteLine($"Genre: {game.Genre}");
> WriteLine($"Image URL: {game.ImageUrl}");
> WriteLine();
> }
> ReadKey();
> Clear();
> }
Was this page helpful?