I am getting some json data posted to my asp.net webapi, but the post parameter is always coming up null - the data is not being serialized correctly. The method looks something like this:
public HttpResponseMessage Post(string id, RegistrationData registerData)
It seems the problem is that the client (which I have no control over) is always sending the content-type as x-www-form-urlencoded
, even though the content is actually json. This causes mvc to try to deserialize it as form data, which fails.
Is there any way to get webapi to always deserialize as json, and to ignore the content-type header?