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 how to prevent this when the objects type supports string.empty.

console.log("DataToPost:", dataToPost);
$.ajax({
    type: "POST",
    contentType: 'application/json'
    url: "../../csweb/Orders/SaveOrderDetails/",
    data: dataToPost,
    success: function (result) {
        console.log(result);
    },
    error: function (e) {
        console.error(e);
    }
});

My model includes nullable DateTime objects. I cannot force all nulls to string.empty on the server.
I am using AutoMapper, so I would prefer not to have to inspect properties individually on the server.


data: JSON.stringify(dataToPost),and you should specify also the contentType to:contentType: "application/json"