I am getting nulls deserializing object. Tried to remove that List keyword, but then I am getting nulls. Error-
Cannot deserialize the current JSON object
`
Maybe you have any ideas how to fix that. :)
Code:
client.BaseAddress = new Uri("https://euw1.api.riotgames.com/lol/match/v4/matchlists/by-account/");
string s = client.GetStringAsync("SRAUZPYTqglRgTjMEzaqY1s-wFMaNZnCjgBHMqQNDnJeJNw?endIndex=10&api_key=RGAPI-7bc6b22c-3ce3-41e6-bfbd-90b1eccb212f").Result;
var rankInfoList = JsonConvert.DeserializeObject<List<MatchInfo>>(s);
Model:
public class MatchInfo
{
public string gameId { get; set; }
public string champion { get; set; }
}
Json:
{
"matches": [
{
"platformId": "EUW1",
"gameId": 4961339963,
"champion": 1,
"queue": 420,
"season": 13,
"timestamp": 1607031715226,
"role": "SOLO",
"lane": "MID"
},
{
"platformId": "EUW1",
"gameId": 4961185949,
"champion": 238,
"queue": 420,
"season": 13,
"timestamp": 1607026682284,
"role": "SOLO",
"lane": "MID"
}
],
"startIndex": 0,
"endIndex": 2,
"totalGames": 120
}