I have to call 3rd party API for currency exchange rate, but the JSON returned keep changing, if i request a MYR
to USD
conversion, it will return me: {"MYR_USD":0.246731}
, so if i request for KRW
to USD
, it will return me {"KRW_USD":0.000888}
.
I will have to map the returned result into pojo using @JsonProperty
, is there any ways that works?
My current hard-coded workaround:
@JsonIgnoreProperties(ignoreUnknown = true)
public class FreeCurrencyExchangeRate {
@JsonProperty("MYR_USD")
private double rate;
public double getRate() {
return rate;
}
public void setRate(double rate) {
this.rate = rate;
}
}