I am using Jersey's POJO mapping feature to map JSON responses to Java
objects. This works, but I would like to have more control. For
example, consider the following JSON, which uses arrays to minimize the
payload:
{
"first_names": [
"Ellen",
...
],
"last_names": [
"Ripley",
...
]
}
This can easily be mapped to:
public class Persons {
@JsonProperty("first_names")
private List<String> firstNames;
@JsonProperty("last_names")
private List<String> firstNames;
}
However, I find this inconvenient and ugly. I would rather prefer
somehow a list of Person POJOs, each one having a firstName and
lastName as a String. Is this possible? Should I revert to low-level
JSON support or can this be achieved via the POJO mapping feature?
I have read the Jersey User Guide, but still have no clue on how to do
this. I would be grateful if someone could point me in the right
direction.
Carsten