Package com.google.gson

Examples of com.google.gson.Gson.fromJson()


        AllLinesUser = AllLinesUser + lineUser;
      }
      readerUser.close();

      Gson gsonUser = new Gson();
      PlayersInfos playersInfos = gsonUser.fromJson(AllLinesUser, PlayersInfos.class);
     
      //Transform playerRatings en communityAccount (pour utiliser des types compatibles avec la sérialisation (pas de MAP !!))
      List<CommunityAccount> listCommunityAccount1 =  TransformDtoObject.TransformPlayersInfosToListCommunityAccount(playersInfos);
     
      //////////////////////////////////
View Full Code Here


        }
        //log.warning(url + " --> " + AllLinesUser.substring(0, 400));
       
        readerUser.close();
        Gson gsonUser = new Gson();
        PlayersInfos playersInfos = gsonUser.fromJson(AllLinesUser, PlayersInfos.class);
       
       
       
       
       
View Full Code Here

        //log.warning(url + " --> " + AllLinesUser.substring(0, 50));
       
       
        readerUser.close();
        gsonUser = new Gson();
        PlayerTankRatings playerTankRatings = gsonUser.fromJson(AllLinesUser, PlayerTankRatings.class);
       
        //pb mapDataPlayerTankRatings is null !!!!!!
        Map<String,List<DataPlayerTankRatings>> mapDataPlayerTankRatings = playerTankRatings.getData();
       
        if(mapDataPlayerTankRatings != null )
View Full Code Here

        AllLinesUser = AllLinesUser + lineUser;
      }
      readerUser.close();

      Gson gsonUser = new Gson();
      tankEncyclopedia = gsonUser.fromJson(AllLinesUser, TankEncyclopedia.class);
    }
   
    //contr�le --------
    if (tankEncyclopedia == null) {
      log.severe("tankEncyclopedia is null" );
View Full Code Here

      while ((line = reader.readLine()) != null) {
        AllLines = AllLines + line;
      }
      reader.close();
      Gson gson = new Gson();
      wnEfficientyTank = gson.fromJson(AllLines, WnEfficientyTank.class);
      System.out.println("wnEfficientyTank" + wnEfficientyTank);
     
      //transform list to hashMap for easy treatement
      //HashMap<String, DataWnEfficientyTank> hMapWnEfficientyTankHashMap = new HashMap<String, DataWnEfficientyTank>();
      for (DataWnEfficientyTank dataWnEfficientyTank : wnEfficientyTank.getData()) {
View Full Code Here

    while ((line = reader.readLine()) != null) {
      AllLines = AllLines + line;
    }
    reader.close();
    Gson gson = new Gson();
    DaoCommunityClan2 daoCommunityClan = gson.fromJson(AllLines, DaoCommunityClan2.class);
    daoCommunityClan.setIdClan(idClan);
    daoCommunityClan.setDateCommunityClan(date);
    //persist clan ?
   
    CommunityClan communityClan = TransformDtoObject.TransformCommunityDaoCommunityClanToCommunityClan(daoCommunityClan);
View Full Code Here

    while ((line = reader.readLine()) != null) {
      AllLines = AllLines + line;
    }
    reader.close();
    Gson gson = new Gson();
    DaoCommunityClan2 daoCommunityClan = gson.fromJson(AllLines, DaoCommunityClan2.class);
    daoCommunityClan.setIdClan(idClan);
    daoCommunityClan.setDateCommunityClan(date);
   
   
    //construction de la liste des joueurs partis ou arrivés dans le clan
View Full Code Here

        String quotes = "{\"mapField\": {\"5\": \"6\", \"7\": \"8\"}}";
        String keyQuotes = "{\"mapField\": {\"5\": 6, \"7\": 8}}";
        String noQuotes = "{\"mapField\": {5: 6, 7: 8}}";

        TestClass res = null;
        res = gson.fromJson(quotes, TestClass.class);
        res = gson.fromJson(keyQuotes, TestClass.class);
        //res = gson.fromJson(noQuotes, TestClass.class); //bug
       
        String wotData = "{  \"status\":\"ok\","
                  "\"count\":1," +
View Full Code Here

        String keyQuotes = "{\"mapField\": {\"5\": 6, \"7\": 8}}";
        String noQuotes = "{\"mapField\": {5: 6, 7: 8}}";

        TestClass res = null;
        res = gson.fromJson(quotes, TestClass.class);
        res = gson.fromJson(keyQuotes, TestClass.class);
        //res = gson.fromJson(noQuotes, TestClass.class); //bug
       
        String wotData = "{  \"status\":\"ok\","
                  "\"count\":1," +
                  "\"data\":" +
View Full Code Here

                                    "}" +
                               "}" +
                      "}" +
                  "}";
        DaoCommunityClan2 comClan = null;
        comClan = gson.fromJson(wotData, DaoCommunityClan2.class);
        System.out.println(comClan);
       
         
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.