在开发过程种;往往需要进行复杂数据的存储,我们一般使用json字符串的形式存储复杂数据,废话不多说上案例:**
使用net的JSON**
net.sf.json-lib
json-lib
2.4
jdk15
1:字符串json转化对象实体类对象或者集合
//对象集合转化json字符串
List allorderList = new ArrayList();
JSONArray exportDataJson = JSONArray.fromObject(allorderList);
String exportData = exportDataJson.toString();
//json字符串转化对象集合
JSONArray jsonArray = JSONArray.fromObject(json);
List reportVoList =JSONArray.toList(jsonArray, Test.class);
2:字符串json与 复杂集合的相应转化
List