Using ASP.NET MVC 3, I’m making a jQuery (ver 1.7.1) AJAX call, like I’ve done a billion times. However, I’ve noted something strange. The following call works fine:
// license object
var license = {
City: "New York",
CompanyID: 1,
County: "N/A",
IsActive: true
};
// make the request
var $req = $.post('/License/theLicense', license);
$req.success(function () {
// this works!
});
[HttpPost]
public void Save(License theLicense)
{
// save
}
However, when I specify the data parameter for the controller it doesn’t register at the controller
// license object
var license = {
City: "New York",
CompanyID: 1,
County: "N/A",
IsActive: true
};
// make the request
// this time the controller parameter is specified
// the object will be blank at the server
var $req = $.post('/License/theLicense', { theLicense: license });
$req.success(function () {
// this does not work
});
The object is blank at the controller as shown below

This is annoying because I will need to pass another data parameter, but I can’t due to this issue.
NOTE: The JSON is identical to the POCO.
Why is it when I specify the data parameter the object shows up blank at the controller, but when I don’t it’s just fine?
Sometimes the POCO deserializer gets caught on for strange reason. I have seen it before where my JSON object exactly matches the POCO and it still won’t deserialize.
When this happens I usually send the object to the server as a JSON string and then deserialize it on the server. I personally use ServiceStack.Text because it is the fastest.
So your jQuery would go like this:
Then your Controller would take in a string parameter (json) to deserialize the object: