How to solve null values being transformed (or not) for JSON post by the modelbinder How to solve null values being transformed (or not) for JSON post by the modelbinder json json

How to solve null values being transformed (or not) for JSON post by the modelbinder


Try using a custom model binder, it may not ultimately be necessary but it will help you debug what is actually happening with the value passed to the server.

It is a very easy process and is really just two steps:

1) Create a class that implements the System.Web.Mvc.IModelBinder interface, I believe it is just the one method, BindModel().

2) Add the binder in the OnApplicationStart() method of the Global.asax.cs like so

ModelBinders.Binders.Add(typeof(AdjustmentDefaultsModel), new YourModelBinder());