Given the below json
{
"countries":{
"country":[{
"name":"USA",
"independence":"July 4, 1776",
}],
},
}
I will like to ignore "countries" and get the value of country instead. hence, after mapping my json should look as so
{
"countries": [{
"name":"USA",
"independence":"July 4, 1776",
}],
}
Is this currently possible with ObjectMapper?
EDIT: below are the Pojo
public class Result {
private static final long serialVersionUID = 6403654749443599206L;
@Getter @Setter @JsonProperty("country") private List<Country> countries;
}
public class Country {
private static final long serialVersionUID = 6403654749443599206L;
@Getter @Setter private String name;
@Getter @Setter private String independence;
}
and I am doing this
return new ObjectMapper().readValue({jsonValue}, Result.class);