Reputation: 31
I am doing a project in springboot rest API. My controller class look like below,
@RequestMapping(value = "/artdimfil", method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
@ResponseBody
public boolean saveArticleDimFilter(@RequestBody ArtDimFil artDimFil)
I want to send the below payload in the postman,
{
"id": "b30d1486-04c8-4acc-8d14-8604c81accab",
"docIdentifier": {
"recType": "ABC",
"accesslist": [
{
"userid": "[email protected]",
"role": "abc",
"status": "Active",
"actiondate": "2020-07-03T17:59:34.600+0000",
"name": "XYZ",
}]
}
}
But it is giving the error saying
[org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize instance of `com.ibm.epm.next.model.Accesslist` out of START_ARRAY token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `com.ibm.epm.next.model.Accesslist` out of START_ARRAY token.
Please suggest me what to do.
Upvotes: 3
Views: 1298
Reputation: 4073
It's trying to deserialize to "AccessList" - but I think it's not using YOUR "AccessList", because the error says:
Cannot deserialize instance of com.ibm.epm.next.model.Accesslist
I suggest you rename your class, or make sure you have the correct import statement. You should import your own "AccessList" class.
Upvotes: 1
Reputation: 11
I think you should delete comma after "XYZ"
{
"userid": "[email protected]",
"role": "abc",
"status": "Active",
"actiondate": "2020-07-03T17:59:34.600+0000",
"name": "XYZ",
}
also will be good show how looks docIdentifier class and show what class inside accesslist
Upvotes: 0