I'm working on a Spring MVC project and one of the tasks I need to do requires me to have a string of JSON data sent through by the user in a POST request. I know that Spring will deserialize JSON using Jackson to objects, but if I try something like the following:
@RequestMapping(value = "/test", method = RequestMethod.POST)
public void doSomething(@RequestBody String json) {
// do something
}
我只需返回HTTP400Bad Request("客户端发送的请求在语法上不正确").
How can I get the raw JSON sent by the client as a string?