Json 与 Entity 实体的转换
- import com.alibaba.fastjson.JSONObject;
- json 转成 List
- String json = new Gson().toJson(map);
List<TeamIntroduceForm> teamIntroduceForms = JSONArray.parseArray(info.getTeamIntroduce(), TeamIntroduceForm.class);
- json 转成Entity
AnswerTemplate answerTemplate = JSONObject.parseObject(record.getAnswer(), AnswerTemplate.class);
- Entity 转 josn
JSONObject.toJSON(record).toString();
- 集合转json
JSONArray.toJSONString(record.getTeamIntroduceForms());
版权声明:本文为fengzyf原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。