JSON转换:实体类和JSONObject互转,List和JSONArray互转(fastjson版)
1.实体类和JSONObject互转
//实体类转为JSONObject
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(xtDmbm));
//JSONObject转为实体类
XtDmbm xtDmbm = JSONObject.toJavaObject(jsonObject, XtDmbm.class);
2.List<T>和JSONArray互转
//List转为JSONArray
JSONArra
原创
2022-02-16 10:21:26 ·
25457 阅读 ·
5 评论