日期:2014-05-16  浏览次数:20336 次

FastJson 示例
http://www.cnblogs.com/zhenmingliu/archive/2011/12/29/2305775.html
http://871421448.iteye.com/blog/1581876
http://blog.sina.com.cn/s/blog_4f925fc30102egx0.html
有这个,解析应该不是问题了
MyUser.java代码如下:
package com.shihuan.test.myfastjson.vo;

import java.util.Date;

public class MyUser {

private Long userid;
private String username;
private boolean sex;
private Date birthday;

public MyUser() {
}

public Long getUserid() {
return userid;
}

public void setUserid(Long userid) {
this.userid = userid;
}

public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

public boolean isSex() {
return sex;
}

public void setSex(boolean sex) {
this.sex = sex;
}

public Date getBirthday() {
return birthday;
}

public void setBirthday(Date birthday) {
this.birthday = birthday;
}
}

MyGroupUser.java代码如下:
package com.shihuan.test.myfastjson.vo;

import java.util.ArrayList;
import java.util.List;

public class MyGroupUser {

private Long groupid;
private String groupname;
private List<MyUser> listuser = new ArrayList<MyUser>();

public MyGroupUser() {
}

public Long getGroupid() {
return groupid;
}

public void setGroupid(Long groupid) {
this.groupid = groupid;
}

public String getGroupname() {
return groupname;
}

public void setGroupname(String groupname) {
this.groupname = groupname;
}

public List<MyUser> getListuser() {
return listuser;
}

public void setListuser(List<MyUser> listuser) {
this.listuser = listuser;
}
}

MyGroupSetUser.java代码如下:
package com.shihuan.test.myfastjson.vo;

import java.util.HashSet;
import java.util.Set;

public class MyGroupSetUser {

private Long groupsetid;
private String groupsetname;
private Set<MyUser> setuser = new HashSet<MyUser>();

public MyGroupSetUser() {
}

public Long getGroupsetid() {
return groupsetid;
}

public void setGroupsetid(Long groupsetid) {
this.groupsetid = groupsetid;
}

public String getGroupsetname() {
return groupsetname;
}

public void setGroupsetname(String groupsetname) {
this.groupsetname = groupsetname;
}

public Set<MyUser> getSetuser() {
return setuser;
}

public void setSetuser(Set<MyUser> setuser) {
this.setuser = setuser;
}
}

MyGroupMapUser.java代码如下:
package com.shihuan.test.myfastjson.vo;

import java.util.HashMap;
import java.util.Map;

public class MyGroupMapUser {

private Long groupmapid;
private String groupmapname;
private Map<String, MyUser> mapuser = new HashMap<String, MyUser>();

public MyGroupMapUser() {
}

public Long getGroupmapid() {
return groupmapid;
}

public void setGroupmapid(Long groupmapid) {
this.groupmapid = groupmapid;
}

public String getGroupmapname() {
return groupmapname;
}

public void setGroupmapname(String groupmapname) {
this.groupmapname = groupmapname;
}

public Map<String, MyUser> getMapuser() {
return mapuser;
}

public void setMapuser(Map<String, MyUser> mapuser) {
this.mapuser = mapuser;
}
}

MyTestJson.java代码如下:
package com.shihuan.test.myfastjson.mytest;

import com.shihuan.core.framework.utils.DateHelper;

import java.ut