I had a working example parsing a JSON string in a KeyValue class.
For some reason now it is returning 0's and/or nulls.
public class KeyValue { //example JSON string: {"SomeCoolPlayerName":{"id":32179899,"name":"SomeCoolPlayerName","profileIconId":547,"summonerLevel":30,"revisionDate":1396953413000}} public long id {get; set;} public string name {get; set;} public int profileIconId {get; set;} public long summonerLevel {get; set;} public long revisionDate {get; set;} // public List<int> champions {get; set;} } Could the JSON string have changed? It is getting populated when I debug I can see it so I added it as a comment above ^^
The web page code is pretty simple also:
try { WebClient client = new WebClient(); var strJSON = client.DownloadString("http://prod.api.pvp.net/api/lol/na/v1.4/summoner/by-name/" + SummonerName + "?api_key=blanked_on_purpose"); JavaScriptSerializer ser = new JavaScriptSerializer(); var KeyValue = ser.Deserialize<KeyValue>(strJSON); var summonerId = KeyValue.id; //var summonerLevel = KeyValue.summonerLevel; txtSummonerId.Text = summonerId.ToString(); } What must I do to get the summonerId correctly again?