ASP.NET Core MVC - empty string to null when sending JSON to server
问题 When posting input data as a FormData to the ASP.NET Core MVC controller, by default empty string values are coerced to null values. However, when sending input data as JSON to the controller, empty string values remain as they are. This leads to different behavior when validating string properties. For example, description field is not bound to null , but to empty string on the server: { value: 1, description: "" } This in turn makes following model invalid, even though Description is not