Here is my JSON I'm returning from my STUB:
{
"brokerAccounts": [
{
"id": "4598",
"customTags": [
"main-buy"
]
}
]
}
Here is the java class for an entity
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class InvestBrokerAccountsRs {
private List<InvestBrokerAccount> brokerAccounts;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public static class InvestBrokerAccount {
private String id;
private List<String> customTags;
}
}
After trying to get it using Feign ResponseEntity<String>
I'm getting this:
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
As I see, my json is valid. I have the @Data
annotation which provides getters and setters. What is a problem?
CodePudding user response:
It looks like to me that this is responsible - ResponseEntity<String>
. You are trying to deserialize your json, which is in json object format into a string, which is not possible, since string format is different.
I think changing to:
ResponseEntity<InvestBrokerAccountsRs>
should fix your problem.