I\'m having issues using Jackson to map a Javascript posted JSON array of hashes (Tag).
Here is the data received by the controller @RequestBody (It is send wit
Another way to do this is to rather obtain an array than a List, as follows:
@RequestBody Tag[] entities
Jackson requires a default constructor with no parameters on custom Objects, so you'll need to simply add a default constructor to your Tag
class.
In your case simply add to your Tag
class:
public Tag(){}
It sounds like Spring is not passing full type information for some reason, but rather a type-erased version, as if declaration was something like List<?> tag
. I don't know what can be done to fully resolve this (may need something from Spring integration team), but one work-around is to define your own type like:
static class TagList extends ArrayList<Tag> { }
and use that instead. This will retain generic parameterization through super-type declarations so that even if Spring only passes equivalent of TagList.class
, Jackson can figure out the Tag
parameter.