I'm trying to deserialize a JSON into an object with Jackson, but the error says
"Handling server error: Can not deserialize instance of
java.util.ArrayList
out of START_OBJECT token"
The JSON has this structure
[{
"id": 685509210310,
"intention_id": 13042,
"cuit": "133423122",
"branch": "Local",
"checkout": "7",
"establishment_id": "21312",
"transaction_datetime": "2021-03-10T17:07:10",
"payment_method_id": 1,
"payment_method_code": "VI",
"payment_method_type": "credit_card",
"card_data": {
"card_brand": "Visa",
"bin": "1211111",
"last_four_digits": "0000",
"bank_data": {
"id": 1,
"description": "Banco"
}
},
"amount": 1200.00,
"currency": "ARS",
"installments": 1,
"status": "approved",
"status_details": {
"card_authorization_code": "11111",
"card_reference_number": " 00000",
"response": {
"type": "approved",
"reason": {
"id": 0,
"description": "APROBADA (authno)",
"ticket_footer": "INFO ADICIONAL "
}
}
},
"terminal_data": {
"trace_number": 43,
"ticket_number": 121,
"terminal_number": "87212121"
}
}
]
I'm trying to deserialize it into my object that has lists of other classes for the JSON inside, but it doesn't work
The method to cast it is
Collection read = new ObjectMapper().readValue(new_salida, new TypeReference<Collection>() {});