fastjson将json格式字符串转成list集合

 1.gameListStr = "[{"gameId":"1","gameName":"哈哈"},{"gameId":"2","gameName":"呵呵"}]";
2. List<Game> gameList = JSONObject.parseArray(gameListStr, Game.class);
public class Game {
   public String gameId;
   public String gameName;

   public String getGameId() {
      return gameId;
   }

   public void setGameId(String gameId) {
      this.gameId = gameId;
   }

   public String getGameName() {
      return gameName;
   }

   public void setGameName(String gameName) {
      this.gameName = gameName;
   }
}

 

posted @ 2019-10-04 16:19  King-DA  阅读(13973)  评论(0编辑  收藏  举报