I configured ContentNegotiationViewResolver in the Spring 3 application, so when I call the controller with a URL that looks like **. json returns a json object using the jackson library.
If I call this method:
@RequestMapping("/myURL.json")
public List<MyClass> myMethod(){
List<MyClass> mylist = myService.getList();
return mylist;
}
In JSON, I get:
{"myClassList":[
{ object 1 in json },
{ object 2 in json },
{ object 3 in json } ...
]
}
my questions are: ¿is there a way to customize the name myClassList which is used in json? ¿Is json possible in this way without this variable (something like the following)?
[
{ object 1 in json },
{ object 2 in json },
{ object 3 in json } ...
]
Thank.
source
share