关于json格式存储数据库成bean对象list,取出来再次转换成json格式
2017-10-30 15:44
585 查看
网上很多list转JsonArray,在实际中用不了,。 private List<WmCheckListBean> checkListBean=new ArrayList<>();
JSONArray arry=new JSONArray();
for (int a=0;a<checkListBean.size();a++){
JSONObject jsonObject=new JSONObject();
try {
jsonObject.put("id",checkListBean.get(a).getCheckId());
jsonObject.put("name",checkListBean.get(a).getCheckName());
jsonObject.put("parentId",checkListBean.get(a).getParentId());
jsonObject.put("type",checkListBean.get(a).getType()); }
catch (JSONException e) {
e.printStackTrace();
}
arry.put(jsonObject);}
相关文章推荐
- 省市县从数据库读出来的list数据转换成json格式的数据
- SpringMVC 中List 对象转换成Json格式 List对象中属性为NUll解决
- 把List对象或者单值对象转换为Json格式
- java中把对象、对象bean、list集合、对象数组、Map和Set以及字符串转换成Json
- 将List对象列表转换成JSON格式的类
- Java中将JSON格式的数据转换成对应的Bean、Map、List数据
- FastJson对于JSON格式字符串、JSON对象及JavaBean之间的相互转换
- FastJson对于JSON格式字符串、JSON对象及JavaBean之间的相互转换
- Java中将JSON格式的数据转换成对应的Bean、Map、List数据
- 数据库存储的数据为 unicode格式,在.NET 读取出来并转换为繁体字?
- [转]将List对象列表转换成JSON格式的类
- net.sf.ezmorph.bean.MorphDynaBean cannotbe cast to xxx 关于JSON对象解析List<XXX>在调用时出错问题
- Android JSON数据格式的解析,与简单对象、带泛型的List和Map的转换,以及GSON的使用
- 将List对象列表转换成JSON格式的类实现方法
- java中把对象、对象bean、list集合、对象数组、Map和Set以及字符串转换成Json
- Java中把对象、对象bean、list集合、对象数组、Map和Set以及字符串转换成Json
- FastJson对于JSON格式字符串、JSON对象及JavaBean之间的相互转换
- 数据库中查询出来的数据转换成json格式
- FastJson对于JSON格式字符串、JSON对象及JavaBean之间的相互转换
- FastJson对于JSON格式字符串、JSON对象及JavaBean之间的相互转换