I had this problem in one of my applications, and I turned it off and set up a small test environment in which the problem still occurs.
I am sending the following object (JSON)
{ "eventName":"Testing from Services", "tickets":10, "_date":"10/10/2013", "_time":"8:00 PM", "ticketsLocation":"Testing from Services", "date":"2013-10-11T00:00:00.000Z" }
using the following ajax call
self.save = function (item, url, success) { $.ajax({ type: "post", data: JSON.stringify(item), contentType: "application/json, charset=utf-8", traditional: true, datatype: "json", url: self.domain + url, success: success, error: self.error }); };
and then data binding with the following code on the server
var Model = this.Bind<PropertyType>();
where PropertyType is the correct type ( Event ).
Here is the Event class for reference
public class Event { public string EventName { get; set; } public int Tickets { get; set; } public Venue Venue { get; set; } public string TicketsLocation { get; set; } public DateTime Date { get; set; } public List<EventRequest> Requests { get; set; } }
This works great in Firefox. In Chrome and IE, the Model ends as an Event object with all null values. As far as I can tell (using Fiddler), the mail request is exactly the same between all browsers. I also tested this on other machines, excluding my machine and / or browsers as a problem.
Any ideas? I donβt understand how the browser affects the binding of the Nancy model ...