Sinaesthetic
Sinaesthetic

Reputation: 12241

json payload coming through with null members

I'm sending a json payload into my WebApi action. For a while, the parameter was null, but then I changed the content type to application/x-www-form-urlencoded and now the object comes through, but all of its members are null or default values

enter image description here

enter image description here

enter image description here

Any ideas?

Upvotes: 0

Views: 442

Answers (1)

Filip W
Filip W

Reputation: 27187

If you are seding a JSON payload then the content type should be Content-Type: application/json.

If you use application/x-www-form-urlencoded like you do now, you are forcing a use of a formatter that's not capable of reading a JSON input.

Upvotes: 1

Related Questions