Spring mvc RequestMapping de json
Estou tendo problemas para criar os RequestParams apropriados para a seguinte string Json:
{
"input": [
{
"personAdres": {
"plaats": "Amsterdam",
"straat": "Grietenstraat",
"huisnummer": "12",
"postcode": "4512UN""
},
"interesses": [
"gas_station",
"soccer"
]
},
{
"personAdres": {
"plaats": "Arnhem",
"straat": "Koningsweg",
"huisnummer": "3",
"postcode": "1953AA"
},
"interesses": [
"gas_station",
"soccer"
]
}
]
}
Eu tentei o seguinte:
@RequestMapping(method = RequestMethod.GET, params = {"input", "personAdres", "plaats", "straat", "huisnummer", "postcode", "interesses"})
public
@ResponseBody`enter code here`
String getMovie(
@RequestParam(value = "input") String[] input,
@RequestParam(value = "personAdres") String[] personAdres,
@RequestParam(value = "plaats") String plaats,
@RequestParam(value = "straat") String straat,
@RequestParam(value = "huisnummer") String huisnummer,
@RequestParam(value = "postcode") String postcode,
@RequestParam(value = "interesses")String[] interesses,
ModelMap model
)
Isso parece não funcionar. Estou recebendo o seguinte erro.
Nenhum método de manipulador correspondente encontrado para solicitação de servlet:
Alguém pode me ajudar a criar o requestParams correto.
Edit: isso parece funcionar
@Controller
@RequestMapping("/dateSuggestie")
public class DateController {
@RequestMapping(method = RequestMethod.GET)
public
@ResponseBody
String getMovie(
@RequestParam(value = "input[0][personAdres][plaats]") String p0Plaats,
@RequestParam(value = "input[0][personAdres][straat]") String p0Straat,
@RequestParam(value = "input[0][personAdres][huisnummer]") String p0HuisNummer,
@RequestParam(value = "input[0][personAdres][postcode]") String p0PostCode,
@RequestParam(value = "input[0][interesses][]") String[] p0Interesses,
@RequestParam(value = "input[1][personAdres][plaats]") String p1Plaats,
@RequestParam(value = "input[1][personAdres][straat]") String p1Straat,
@RequestParam(value = "input[1][personAdres][huisnummer]") String p1HuisNummer,
@RequestParam(value = "input[1][personAdres][postcode]") String p1PostCode,
@RequestParam(value = "input[1][interesses][]") String[] p1Interesses) {