Need to map multiple types of JSON responses to a single POJO so that I can compare the different objects to provide insight about the differences.
I had tried mapping the first response to the POJO and parsed the second response to populate the defined 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>();
}
First response:
[
{
"ACCOUNT_NAME": "",
"ACCOUNT_NUMBER": "",
"AVAILABLE_BALANCE": null,
"CURRENT_BALANCE": "",
"FULL_ACCOUNT_NUMBER": null,
}
]
Second response:
"bankAccount": [
{
"accountName": "",
"accountNumber": "",
"routingNumber": "",
"fullAccountNumber": "",
"bankTransferCodeType": "",
"acctType": "",
"transactionList": {
"transaction": [
{
"amount": {
"curCode": "",
"content": ""
}
],
"oldestTxnDate": ""
},
"uniqueId":
}
}
Expecting a generic way to map the different structured JSON entities to single POJO.