赞
踩
import java.util.ArrayList;
import java.util.List;
import net.sf.json.JSONObject;
public class Test {
private int userid;
private String userName;
public int getUserid() {
return userid;
}
public void setUserid(int userid) {
this.userid = userid;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public static void main(String[] args) {
JSONObject jo=new JSONObject();
jo.put("userid", 1);
jo.put("userName", "张三");
Test test=new Test();
test.setUserid(Integer.parseInt(jo.get("userid").toString()));
test.setUserName(jo.get("userName").toString());
List<Test> list=new ArrayList<Test>();
list.add(test);
System.out.println(jo);
}
}
//多组JSON对象就循环add。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。