小编use*_*639的帖子

来自json的Spring mvc RequestMapping

我在为以下Json字符串创建适当的RequestParams时遇到问题:

{
  "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"
      ]
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

我尝试了以下方法:

 @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 …
Run Code Online (Sandbox Code Playgroud)

java spring-mvc

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

java ×1

spring-mvc ×1