Reputation: 1139
I have the following field:
@JsonProperty("data")
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
private HashMap<Date,String> data;
I want to apply CustomJsonDateDeserializer
only on map keys.
Thank you in advance
Upvotes: 2
Views: 1025
Reputation: 1139
After carefully reading the documentation, I found the solution to my problem.
@JsonProperty("data")
@JsonDeserialize(keyUsing = CustomJsonDateDeserializer.class, keyAs = Date.class)
private HashMap<Date,String> data;
CustomJsonDateDeserializer
has to extend the KeyDeserializer
class.
Upvotes: 3