I have a following class:
@Data
@NoArgsConstructor
public class FloorPriceData {
Double multiplicationFactor;
Double additionFactor;
Integer heuristicValue;
public static void main(String[] args) {
String a = "{\"multiplicationFactor\" : 3, \"additionFactor\" : 1, \"heuristicValue\" : 3}";
System.out.println(Utils.getMapper().convertValue(a, FloorPriceData.class));
}
}
When I try to convert JSON
{"multiplicationFactor" : 3, "additionFactor" : 1, "heuristicValue" : 3}
to this class instance I get following exception:
Getting Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of com.medianet.rtb.mowgli.commons.dto.adexchange.FloorPriceData: no String-argument constructor/factory method to deserialize from String value ('{"multiplicationFactor" : 3, "additionFactor" : 1, "heuristicValue" : 3}')