我正在尝试从此网址的json访问数据:http://na.lolesports.com/api/gameStatsFantasy.json?tournamentId=104。
我使用了一个名为http://json2csharp.com/的网站来帮助创建要序列化的类。它工作但我注意到JSON有许多相同的gameID,playerID和teamID的重复实例(例如一个名为Game2998和Game29982或team4和team42)。
public class RootObject
{
public TeamStats teamStats { get; set; }
public PlayerStats playerStats { get; set; }
}
public class TeamStats
{
public Dictionary<string, Game> GameID { get; set; }
}
public class PlayerStats
{
public Dictionary<string,game> gameID { get; set; }
}
public class Game
{
public string dateTime { get; set; }
public Team blueTeam { get; set; }
public Team purpleTeam { get; set; }
public string matchId { get; set; }
}
public class game
{
public string dateTime { get; set; }
public string matchId { get; set; }
public Player bluePlayer1 { get; set; }
public Player bluePlayer2 { get; set; }
public Player bluePlayer3 { get; set; }
public Player bluePlayer4 { get; set; }
public Player bluePlayer5 { get; set; }
public Player purplePlayer1 { get; set; }
public Player purplePlayer2 { get; set; }
public Player purplePlayer3 { get; set; }
public Player purplePlayer4 { get; set; }
public Player purplePlayer5 { get; set; }
}
public class Player
{
public int playerId { get; set; }
public int kills { get; set; }
public int deaths { get; set; }
public int assists { get; set; }
public int minionKills { get; set; }
public int doubleKills { get; set; }
public int tripleKills { get; set; }
public int quadraKills { get; set; }
public int pentaKills { get; set; }
public string playerName { get; set; }
public string role { get; set; }
}
public class Team
{
public int teamId { get; set; }
public string teamName { get; set; }
public int matchVictory { get; set; }
public int matchDefeat { get; set; }
public int baronsKilled { get; set; }
public int dragonsKilled { get; set; }
public int firstBlood { get; set; }
public int firstTower { get; set; }
public int firstInhibitor { get; set; }
public int towersKilled { get; set; }
}