SoFunction
Updated on 2025-03-08

Springboot receives POST request, data is json type problem

Springboot receives POST request, data of type json

When the data transmitted from the current end is of json type and is a POST request, the backend cannot simply use @RequestParam to obtain data.

@RequestBody should be used

Make a map, and then use the map's get method to get each parameter.

@PostMapping("/updateCoinInfo")
    public MsgEntity updateCoinInfo(@RequestBody Map<String, String> params)
("coin")

Summarize

The above is personal experience. I hope you can give you a reference and I hope you can support me more.