© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•10mo ago•
22 replies
Theos

Issue when deserializing web response

Hey, I'm making a simple call to the api and looking at the text reponse it looks correct (check first image).
HttpResponseMessage response = await client.GetAsync(nextPageUrl);
string responseBody = await response.Content.ReadAsStringAsync();

if (response.IsSuccessStatusCode)
{
    var animeListResponse = JsonSerializer.Deserialize<AnimeListResponse>(responseBody,
        new JsonSerializerOptions { PropertyNameCaseInsensitive = true });

    if (animeListResponse.Data != null)
    {
        animeList.AddRange(animeListResponse.Data);
    }
HttpResponseMessage response = await client.GetAsync(nextPageUrl);
string responseBody = await response.Content.ReadAsStringAsync();

if (response.IsSuccessStatusCode)
{
    var animeListResponse = JsonSerializer.Deserialize<AnimeListResponse>(responseBody,
        new JsonSerializerOptions { PropertyNameCaseInsensitive = true });

    if (animeListResponse.Data != null)
    {
        animeList.AddRange(animeListResponse.Data);
    }


For some reason
ListStatus
ListStatus
is always null (look at second image)

public class AnimeListResponse
{
    public AnimeData[] Data { get; set; }
    public Paging Paging { get; set; }
}

public class AnimeData
{
    public AnimeNode Node { get; set; }
    public ListStatus ListStatus { get; set; }
}

public class AnimeNode
{
    public int Id { get; set; }
    public string Title { get; set; }
}

public class ListStatus
{
    [JsonPropertyName("status")]
    public string Status { get; set; }

    [JsonPropertyName("score")]
    public int Score { get; set; }

    [JsonPropertyName("num_episodes_watched")]
    public int Num_Episodes_Watched { get; set; }
}
public class AnimeListResponse
{
    public AnimeData[] Data { get; set; }
    public Paging Paging { get; set; }
}

public class AnimeData
{
    public AnimeNode Node { get; set; }
    public ListStatus ListStatus { get; set; }
}

public class AnimeNode
{
    public int Id { get; set; }
    public string Title { get; set; }
}

public class ListStatus
{
    [JsonPropertyName("status")]
    public string Status { get; set; }

    [JsonPropertyName("score")]
    public int Score { get; set; }

    [JsonPropertyName("num_episodes_watched")]
    public int Num_Episodes_Watched { get; set; }
}
image.png
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Another Deserializing issue
C#CC# / help
4y ago
Only response web socket
C#CC# / help
2y ago