I have JSON from payfort to read the transactions, tried to parse it to POJO but always gave to me the mismatch erorr
[
[
{
"response_code": "04000",
"card_holder_name": null,
"acquirer_mid": "***",
"payment_link_id": null,
"order_description": "21882 - SAR"
}
],
{
"data_count": 70
}
]
This is my root pojo and I parse it using string
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DownloadReportResponse {
private TransactionCount transactionCount;
private List<TransactionsResponse> transactions;
}
Parsing :
List<DownloadReportResponse> properties = new ObjectMapper().readValue(report, new TypeReference<>() {
});
Object[]and thus there's no easy way for Jackson to know what to expect here. You might need to either provide a custom deserializer (which could delegate to the standard ones) or try to first parse the json into a generic structure and then deserialize the individual elements based on whether it is another array or an object - assuming you know what the types of those would be.