post json 对象 数组 到spring mvc

客户端post 的json格式

{
    "apList": [
        {
            "bssid": "1234444",
            "name": "fasfafaf",
            "signalStrength ": "80",
            "scanTime": "UTC 2013-03-12 10:12:12",
            "status": "true"
        }
    ]
}
服务端spring mvc处理


@RequestMapping(value = "test/uppost", method = RequestMethod.POST)
    @ResponseBody
    public void uploadTest(@RequestBody ApList apList) {}
ApList类如下

public class ApList {
    private List<ApBean> apList;
 
    public List<ApBean> getApList() {
        return apList;
    }
 
    public void setApList(List<ApBean> apList) {
        this.apList = apList;
    }
 
}
ApBean类如下

public class ApBean {
    private String bssid;
    private String name;
    private int signalStrength;
    private String scanTime;
    private boolean status;
 //get set ......
}

你可能感兴趣的:(json,spring mvc)