We Are Going To Discuss About com.fasterxml.jackson.databind.exc.MismatchedInputException: Can not deserialize instance of object out of START_ARRAY token. So lets Start this Java Article.
com.fasterxml.jackson.databind.exc.MismatchedInputException: Can not deserialize instance of object out of START_ARRAY token
- com.fasterxml.jackson.databind.exc.MismatchedInputException: Can not deserialize instance of object out of START_ARRAY token
You have mapped the
RequestBody
to a singleUser
object but you are sending in JSON array.[{ "firstName": "hgf", "lastName": "frew", "username": "erf", "email": "bgghjk", "password": "bgte", "role": "trrere" } ]
- com.fasterxml.jackson.databind.exc.MismatchedInputException: Can not deserialize instance of object out of START_ARRAY token
You have mapped the
RequestBody
to a singleUser
object but you are sending in JSON array.[{ "firstName": "hgf", "lastName": "frew", "username": "erf", "email": "bgghjk", "password": "bgte", "role": "trrere" } ]
Solution 1
You have mapped the RequestBody
to a single User
object but you are sending in JSON array.
[{
"firstName": "hgf",
"lastName": "frew",
"username": "erf",
"email": "bgghjk",
"password": "bgte",
"role": "trrere"
}
]
You should send a JSON object instead as follows
{
"firstName": "hgf",
"lastName": "frew",
"username": "erf",
"email": "bgghjk",
"password": "bgte",
"role": "trrere"
}
or change the controller mapping to receive a collection of User
objects as
@RequestBody List<User> users
Original Author Master Po Of This Content
Conclusion
So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.