Deserializing json array in Spring MVC controller

后端 未结 3 1180
滥情空心
滥情空心 2021-01-19 14:33

I am sending a list of json object and trying to deserialize it in my Spring controller. But all the time I am getting error of \'Bad request\' and results into a status co

3条回答
  •  耶瑟儿~
    2021-01-19 15:04

    I think you need to change your @RequestBody POJO to UserWrapper

    @RequestMapping(value="/task/add", method=RequestMethod.POST, 
            produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
    @ResponseBody
    public void createTeamMember(@RequestBody UserWrapper userWrapper) {
        // Code to create members
    }
    

提交回复
热议问题