title: Spring MVC : post request and json object with array : bad request
body: <p>I'm trying to retrieve parameters from a http POST request with Spring MVC.</p>
  
  <p>The request contains the following json object (content-type : application/json), which itself contains an array of customObjects :</p>
  
  <pre><code>{  
     "globalId":"338",
     "lines":[  
        {  
           "id": "someId",
           "lib":"blabla",
          ...
  
        }
     ]
  }
  </code></pre>
  
  <p>Here's the code I'm trying to use :</p>
  
  <pre><code>  @RequestMapping(method = RequestMethod.POST, value = "/valider")
    @ResponseBody
    public void valider(final HttpServletRequest request, @RequestParam("globalId") final String globalId, @RequestParam("lines") final MyCustomObject[] lines) {
  </code></pre>
  
  <p>All I'm getting is a "bad request" error (http 400).</p>
  
  <p>Is it possible to separately retrieve the two parameters "globalId" and "lines" ? Or since they are in the same json object, it has to be treated has a single parameter ? How do you proceed when you have more than one parameter in a Post request ?</p>