JSON的简单使用
JSONObject,http://www.json.org/javadoc/org/json/JSONObj
ect.html: 主要用于把JavaBean对象变成JSon对象。如下, {departmentId:122,departmentName:fsadfdf}
public void test(){
TestDepartment td = new TestDepartment
();
td.setDepartmentId(122);
td.setDepartmentName("fsadfdf");
JSONObject jb = new JSONObject(td);
System.out.println(jb.toString());
}
JSONObject 的使用:就是把JavaBean对象构造成JSON对象