也许有人可以帮助我,并告诉对象对象结构是成功进行JSON这样的成功转换的原因?
{"converted":{"BYN": {"amount": "753.48", "currency": "BYN"}, "USD": {"amount": "350.00", "currency": "USD"}}}
我尝试创建对象,但是没有用:
public enum Currency {
USD,
BYN;
}
public class CurrencyInfo {
private Double amount;
private Currency currency;
}
public class Converted {
private Map<Currency, CurrencyInfo> convertedAmount;
}
我在哪里错了?
答案 0 :(得分:1)
在Converted
类中使用以下内容:
class Converted {
private Map<Currency, CurrencyInfo> converted;
public Map<Currency, CurrencyInfo> getConverted() {
return converted;
}
public void setConverted(Map<Currency, CurrencyInfo> converted) {
this.converted = converted;
}
}