当前位置:编程学习 > JAVA >>

java数据转化为json数据

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);
    }
}
补充:移动开发 , Android ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,