Swapping out the standard serializer for the JSON.NET serializer is a non-issue. Code below was taken directly out of Scott Hanselman's blog
http://www.hanselman.com/blog/OnTheNightmareThatIsJSONDatesPlusJSONNETAndASPNETWebAPI.aspx
JsonSerializerSettings serializerSettings = new JsonSerializerSettings() { ReferenceLoopHandling = ReferenceLoopHandling.Ignore };
serializerSettings.Converters.Add(new IsoDateTimeConverter());
GlobalConfiguration.Configuration.Formatters[0] = new JsonNetFormatter(serializerSettings);
However, after doing this I can't save anything, ajax call fails. The error that I get back is:
This DataController does not support operation 'Insert' for entity 'JObject'.
JObject is what is being returned from the JSON.NET serializer. It isn't honoring the "__type" property that is being attached to the entity.
Example JSON:
[{"Id":"0","Operation":1,"Entity":{"__type":"Product:#Catalog.Models","Sku":"adsfadsf"}}]
Is there anything that I can do short of dipping into the JSON.NET source code to fix this? Is there an update coming to the ASP.NET MVC 4 Beta that will fix this?
ASP.NET MVC 4 is still in beta and there are several features that don't quite work 100% yet. The last time I checked the integration of Newtonsoft.Json and the JsonSerializer is not complete. After talking with some folks on the ASP.NET team it is my understanding that it is being worked on but there are no timelines for completion.