I have this class:
@JsonIgnoreProperties(ignoreUnknown = true)
public class VehicleRestModel implements RestModel<Article> {
@JsonProperty("idVehicle")
public String id;
public String name;
}
And I get this JSON from REST API:
[
{ "idVehicle" : "1234DHR", "tm" : "Hyundai", "model" : "Oskarsuko"},
//more vehicles
]
I want my model's field name
to be JSON's fields tm
and model
concatenated. I have though to use a JsonDeserializer
but, how can I get the whole JSON object inside?
class MyDeserializer implements JsonDeserializer<String, String> {
@Override
public String deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
// I need the entire JSON here, in order to concatenate two fields
}
}
Thanks!