Esempio n. 1
0
    public static List <GameInfo> ParseToListOfGameInfos(this string jsonData)
    {
        List <GameInfo> result = new List <GameInfo>();

        if (jsonData.Length < 20)
        {
            return(result);
        }

        string json = jsonData
                      .Replace(" ", "")
                      .Replace("\n", "")
                      .Replace("{\"games\":[", "")
                      .Replace("}]}", "}")
                      .Replace("},{", "}###{");

        foreach (var item in json.Split(new string[] { "###" }, System.StringSplitOptions.RemoveEmptyEntries))
        {
            GameInfoWrapper gameWrapper = JsonUtility.FromJson <GameInfoWrapper>(item);
            GameInfo        game        = gameWrapper.ParseToGame();
            result.Add(game);
        }

        return(result);
    }
Esempio n. 2
0
    public static GameInfo ParseToGameInfo(this string jsonData)
    {
        GameInfoWrapper gameWrapper = JsonUtility.FromJson <GameInfoWrapper>(jsonData);
        GameInfo        gameInfo    = gameWrapper.ParseToGame();

        return(gameInfo);
    }