需要将多种类型的 JSON 响应映射到单个 POJO,以便我可以比较不同的对象以深入了解差异。
我曾尝试将第一个响应映射到 POJO 并解析第二个响应以填充定义的 POJO:
class XXX {
@JsonProperty("accountHolder")
private String accountHolder;
@JsonProperty("routingNumber")
private String routingNumber;
@JsonProperty("balance")
private List<Balance> balance;
@JsonProperty("accountName")
private String accountName;
@JsonProperty("bankTransferCodeType")
private String bankTransferCodeType;
@JsonProperty("individualInformation")
private IndividualInformation individualInformation;
@JsonProperty("acctType")
private String acctType;
@JsonProperty("transactionList")
private TransactionList transactionList;
@JsonProperty("accountNumber")
private String accountNumber;
@JsonProperty("uniqueId")
private String uniqueId;
@JsonProperty("bankNetID")
private String bankNetID;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
}
第一反应:
[
{
"ACCOUNT_NAME": "",
"ACCOUNT_NUMBER": "",
"AVAILABLE_BALANCE": null,
"CURRENT_BALANCE": "",
"FULL_ACCOUNT_NUMBER": null,
}
]
第二个回应:
"bankAccount": [
{
"accountName": "",
"accountNumber": "",
"routingNumber": "",
"fullAccountNumber": "",
"bankTransferCodeType": "",
"acctType": "",
"transactionList": {
"transaction": [
{
"amount": {
"curCode": "",
"content": ""
}
],
"oldestTxnDate": ""
},
"uniqueId":
}
}
期待一种将不同结构化 JSON 实体映射到单个 POJO 的通用方法。
慕尼黑8549860
MYYA
慕姐4208626
海绵宝宝撒
慕神8447489
相关分类