I am fairly new to C# / JSON and am working on a pet project to show summoner/game information from league of legends.
I am trying to get the summoner id for the requested summoner name.
Here is the JSON returned:
{"twopeas": {
"id": 42111241,
"name": "Twopeas",
"profileIconId": 549,
"revisionDate": 1404482602000,
"summonerLevel": 30
}}
Here is my summoner class:
public class Summoner
{
[JsonProperty(PropertyName = "id")]
public string ID { get; set; }
}
Here is the rest:
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
result = reader.ReadToEnd();
var summonerInfo = JsonConvert.DeserializeObject<Summoner>(result);
MessageBox.Show(summonerInfo.ID);
summonerInfo.ID
is null and I don't know why.
I'm sure there is something glaringly obvious that I am missing, but I'm at a loss I can't for the life of me figure it out.