java数据转化为json数据
来源:网络 责任编辑:栏目编辑 发表时间:2013-07-01 16:42 点击:次
public class Convert {
public static JSONObject generate(List list) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("totalProperty", list.size());
map.put("root", list);
return JSONObject.fromObject(map);
}
public static JSONObject javabean2json(Object object) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("success", true);
map.put("data", object);
return JSONObject.fromObject(map);
}
}
public static JSONObject generate(List list) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("totalProperty", list.size());
map.put("root", list);
return JSONObject.fromObject(map);
}
public static JSONObject javabean2json(Object object) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("success", true);
map.put("data", object);
return JSONObject.fromObject(map);
}
}
相关新闻>>
最新推荐更多>>>
热门新闻进入移动开发频道>>
- 发表评论
-
- 最新评论 更多>>