实体类转换

来源:互联网 发布:游戏试玩网站源码 编辑:程序博客网 时间:2024/06/14 17:48

转集合实体类

JSONObject obj =new JSONObject(json);

JSONObject list = obj.optJSONObject("list");

List<BonusPoolEntity.ListBean.LotteryLogBean> logBeanList = com.alibaba.fastjson.JSONObject.parseArray(list.optJSONArray("lottery_log").toString(),BonusPoolEntity.ListBean.LotteryLogBean.class);


HashMap 转实体类

private void initNews(BaseViewHolder baseViewHolder, final HashMap<String, Object> stringObjectHashMap) {    final MoreSectionDatasBean.NewsSectionDatasBean newsSectionDatasBean=            JSONObject.parseObject(JSON.toJSONString(stringObjectHashMap),MoreSectionDatasBean.NewsSectionDatasBean.class);
}

原创粉丝点击