I am trying to use Riot games REST API to make a webapp in C#. I am fine with making the requests using RESTSharp but am having some problems using JSON.Net to convert the returned Json to an object. My request returns a JSON string for example:
{\"dyrus\":{\"id\":4136713,\"name\":\"Dyrus\",\"profileIconId\":23,\"summonerLevel\":1,\"revisionDate\":1376908220000}}
I want to deserialize this into an object that has attributes: id, name, profileIconID, summonerLevel and revisionDate.
The problem I am having is that the information is being deserialized as a string because the Dictionary is nested. What is the best way to just retrieve the nested Dictionary portion of the string: {\"id\":4136713,\"name\":\"Dyrus\",\"profileIconId\":23,\"summonerLevel\":1,\"revisionDate\":1376908220000} and convert it into an object?
Thanks for your help!
Edit:
Here is what I have tried:
public class LeagueUser
{
public LeagueUser(string json)
{
JavaScriptSerializer serializer = new JavaScriptSerializer();
string jsonString = (string)serializer.DeserializeObject(json);
LeagueUser test = (LeagueUser)serializer.DeserializeObject(jsonString);
}
public int id { get; set; }
public string name { get; set; }
public long revisionDate { get; set; }
}