I need to map string JSON by key-value into the POJO class, but I'm not sure there is an easier way to convert this.
My class:
class Colors {
private String name;
private String color;
public String getName() { return name; }
public String getColor() { return color; }
}
Example of JSON:
{
"white": "FFFFFF",
"red": "FF0000",
"black": "000000"
}
Is there any way (instead of using foreach loop) to have the above JSON in List<Colors>
?
P.s: I tried some same issue with objectMapper.readValue
, but didn't succeed.