Date serialization of JsonValue

Topics: Web Api
Mar 5, 2012 at 6:17 PM

Hi,

I'm using the Web API Preview 6, and I am trying to get a CLR object with a DateTime property to get serialized.

Based on what is said in this document: http://wcf.codeplex.com/wikipage?title=JsonValue (Section 3),

my understanding is that datetime properties should be serialized ISO 8601. However, I'm seeing the ASP.NET Ajax format being used... which is very awkward for interoperability. Has anyone else run into this? Any suggestions on how can I get the ISO 8601 format?

Thanks!

Mario

Coordinator
Mar 5, 2012 at 10:33 PM

That document is only for the JsonValue type and friends. If you have your own data contract type, then the DataContractJsonSerializer will use the ASP.NET Ajax format.

This will be fixed in ASP.NET Web API once we move to using Json.NET.

I also strongly recommend moving to ASP.NET Web API and posting all future questions to the ASP.NET Web API forum. We will not be developing WCF Web API any further.

Daniel Roth