Dosent the Json-processor support native datatypes?

Topics: Web Api
Jul 28, 2011 at 10:49 AM

I have been trying out web api for the first time using the guide at http://wcf.codeplex.com/wikipage?title=Getting%20started:%20Building%20a%20simple%20web%20api but had a hard time getting it to work properly. I got my endpoint working fine with xml but when i tried to get it to return Json i only got and empty status-200 response. No errors, just an emty response.

After fiddeling a bit with my code i noticed a differance in the example and my code where i had used a datetime in my model. After removing that it worked as expexted.

Dosent the Json-processor that comes with web api support native types?

Im using hte latest version off NuGet by the way.

Coordinator
Aug 4, 2011 at 7:38 AM

DataContractJsonSerializer has some issues with dates. You can however replace our default formatter to use something like Json.net. You can use this nuget package: http://nuget.org/List/Packages/netfx-WebApi.JsonNetFormatter here.