JAVA JSON转Model

json数据源

//{"databaseLinkId":"d989d7d9-3a87-4733-9fcd-fb0667fb080f",
// "dbTable":"[{\"name\":\"ACT_GE_BYTEARRAY\",\"field\":\"\",\"relationName\":\"\",\"relationField\":\"\"}]",
// "formData":"[{\"id\":\"1\",\"text\":\"主表信息\",\"componts\":[{\"title\":\"备注2\",\"type\":\"text\",\"table\":\"ACT_GE_BYTEARRAY\",\"field\":\"REV_\",\"proportion\":\"1\",\"verify\":\"\",\"isHide\":\"0\",\"dfvalue\":\"\",\"id\":\"24f35cf0-1bfd-8715-b9ba-7029c22b72f6\"}]}]",
// "queryData":"{\"width\":\"400\",\"height\":\"220\",\"isDate\":\"1\",\"DateField\":\"NAME_\",\"fields\":[{\"portion\":\"1\",\"compontId\":\"24f35cf0-1bfd-8715-b9ba-7029c22b72f6\",\"id\":\"ACT_GE_BYTEARRAYREV_\"}]}",
// "colData":"{\"isPage\":\"1\",\"fields\":[{\"id\":\"ACT_GE_BYTEARRAYREV_\",\"field\":\"REV_\",\"align\":\"left\",\"width\":100,\"fieldName\":\"备注2\"}],\"btns\":[\"add\",\"edit\",\"delete\",\"print\"],\"btnexs\":[],\"isTree\":\"0\",\"treeSource\":\"\"}",
// "baseInfo":"{\"createUser\":\"1\",\"name\":\"1\",\"describe\":\"1\",\"outputArea\":\"\",\"mappingDirectory\":\"1\",\"serviceDirectory\":\"1\",\"webDirectory\":\"1\"}"}

 

转换Demo,支持list,父子类

 

BaseModel baseInfoObj = JSON.parseObject(baseInfo,BaseModel.class);
ArrayList<CodeFormTabModel> formDataObj =JSON.parseObject(formData,ArrayList.class);
QueryModel queryDataObj =JSON.parseObject(queryData,QueryModel.class);

 

发布了230 篇原创文章 · 获赞 184 · 访问量 35万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览