fastjson的json字符串转List

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

 


 1 public class Game {
 2    public String gameId;
 3    public String gameName;
 4 
 5    public String getGameId() {
 6       return gameId;
 7    }
 8 
 9    public void setGameId(String gameId) {
10       this.gameId = gameId;
11    }
12 
13    public String getGameName() {
14       return gameName;
15    }
16 
17    public void setGameName(String gameName) {
18       this.gameName = gameName;
19    }
20 }

 

posted @ 2018-04-20 17:19  Other+  阅读(59541)  评论(0编辑  收藏  举报