I am trying to publish json objects for MVC in a visual studio 2015 preview. However, the data does not seem to be related to the action methods parameter. There used to be a JsonValueProviderFactory registered in previous versions of MVC that handled this, but I can't find it in MVC6? Has the setting used to work out of the box in previous versions changed?
Basically, I have a controller method
public ActionResult Save(Person person)
{
...
}
What I'm trying to call from javascript:
var personData = { Name : 'John Doe' };
$.ajax({
url: '@Url.Content("~/Person/Save")',
type: "POST",
data: JSON.stringify(personData ),
dataType: "json",
contentType: "application/json; charset=utf-8"
})
In previous versions of MVC, the json object was mapped to the C # parameter, see this article, for example http://webcognoscere.com/post/How-to-POST-a-JSON-object-to-a-Controller-Action.aspx