I need to send a POST request with the following JSON body:
{
"date": "2020-08-21"
}
The date field has java.sql.Date type. This request results in an error which says that it could not deserialize the given string "2020-08-21" to sql.Date. If I change the JSON by adding some kind of time:
{
"date": "2020-08-21 00:00:00"
}
It works fine. However, I would like to be able to send only Date values without the time, and be able to convert it to sql.Date. Any ideas on how to work around this? I would really not like to use a String for date and then map it to Date. Are there better ways to do this?