mardi 24 mars 2015

Array of JSON in @RequestParam in Spring MVC

I am sending the following JSON to a controller and trying to access it but i am getting "The request sent by the client was syntactically incorrect." error message.


JSON :



{
"employees": [
{
"firstName": "John",
"lastName": "Doe"
},
{
"firstName": "Anna",
"lastName": "Smith"
},
{
"firstName": "Peter",
"lastName": "Jones"
}
]}


controller:



@RequestMapping(value="/xyz",produces="application/json",consumes="application/json",method=RequestMethod.POST)
public String sendEmpDetails(@RequestBody List<Employee> employeeList){
return "xyz";
}


What am i doing wrong here?


Aucun commentaire:

Enregistrer un commentaire