I\'m passing an object from client to server. Properties of the object which are represented as string.empty are being converted to null during this process. I was wondering
When posting data with $.ajax
, null
is not a possible value for a property of the data
option. If you look at the request with an http debugger, you will see that it's converted to an empty string.
So I guess that your MVC controller is applying the opposite conversion.
What I do in an ajax application to workaroung this issue is that I don't use the data
option of $.ajax()
, but I serialize everything in JSON and put it into a single field "data" of the data option. Like that you don't have problems with null values. Of course, you have to deserialize on the server side.