Im trying to make a program using the League of legends API. The API doesnt return a array of objects. It has different objects for each champions. My question is, how can i get these objects into a c# list without having to make a object for each champion in C#? https://global.api.pvp.net/api/lol/static-data/euw/v1.2/champion?api_key=362039df-6ce4-4e2f-ac3c-27d246d03f45 (This is the json list im getting) I have the following code to convert the objects, but obviously it cannot fill the list.
var webclient = new WebClient();
var strJson = webclient.DownloadString("https://global.api.pvp.net/api/lol/static-data/euw/v1.2/champion?api_key=362039df-6ce4-4e2f-ac3c-27d246d03f45");
var List<ChampionJson> = JsonConvert.DeserializeObjectList<<ChampionJson>>(strJson);
This is the champion class:
public class ChampionJson
{
public Champion champion { get; set; }
}
public class Champion
{
[JsonProperty("id")]
public int id { get; set; }
[JsonProperty("key")]
public string key { get; set; }
[JsonProperty("name")]
public string name { get; set; }
[JsonProperty("title")]
public string title { get; set; }
}
I know its probably completely wrong what im doing but im pretty new to Json. I have been trying to get it to work the past two days but i cannot find anything on the internet. Pls help, Thanks in advance!
jsonresponse.