web-api POST body object always null
If the any of values of the request's JSON object are not the same type as expected by the service then the [FromBody]
argument will be null
.
For example, if the age property in the json had a float
value:
"age":18.0
but the API service expects it to be an int
"age":18
then student
will be null
. (No error messages will be sent in the response unless no null reference check).