I am creating a REST API using the Web API. The problem I am facing is that the JSON serializer does not reject non-displayable fields. Assuming I have a simple object:
public class MyClass
{
public bool MyBool { get; set; }
public string MyString { get; set; }
}
And I have a simple controller that takes an object of this type in the request body
public void Post(MyClass instace)
{
...
}
Now I am sending a request to the endpoint of this controller with the following JSON in the request body:
{"MyBool": true, "MyString": "Really", "InvalidField": "Invalid"}
, true MyBool "Valid" MyString, InvalidField. , , ?