So, you are introducing a BREAKING CHANGE with this. Just GREAT!!!I know you may hate the existing datetime format (I do to), but existing sites really rely on that, and this artical on MSDN.Basically, I can't just update to use this instead of the existing api for a few reasons:1) Breaking the contract - We have told our users that the date has to be in this format2) We have a strict restriction on using 3rd party libraries, so now you are DEFAULTING to it?? Our legal department will have a fit!3) This also means you won't be using the DataContractJsonSeralizer anymore? What about WCF? Is it also switching, or do we have issues within our own app (WCF expecting one format, and this giving another).PLEASE DO NOT set JSON.NET as the default, but make it available, and fix the DataContractJsonSerializer to support more date formats than the /Date(xxx)/ one. My concern is the same.
If I just upgrade, without making any code changes, it will change the format. This release was SUPPOSED to be an inline update that DID NOT have any breaking changes - THIS IS ONE.And then, what about, like us, a large corp that can't update everything at once, we have some using the old and some using the new format.This means, even if we could get by our legal department (they look really hard at the license agreement) that we can NEVER use the new format, as it won't work with the systems that still require the old, unless they update DataContractJsonSerializer with support for more dates.
Chad - You don't use modernizr, Jquery, jqueryUI or any of the other 3rd party libs? This will be supported Open Source just like our existing uses I open source. Want to use a different default?
Easy to switch back. Remember that when we include open source, we back it with support.
If you call and have a problem with ASP.NET, we will support all of it, including the open source we ship. Does that help? We have been doing that for 3+ years now.Also, Chad - we are changing only ASP.NET Web API.A product that isn't released. We aren't changing asp.net proper or WCF. There is no breaking change as this is a new product, only now in beta. OK, so now only the webapi is updated, that is better, but we still won't be able to use it.I was more making a point about the library (as we already use JSON.NET in some situations.The problem I see now is one of incompatibility.
If you aren't updating WCF, or ASP.NET, dates creating in one won't work in the other. So how do you suggest calling an existing service when you have a DateTime as a property in the serialized object?
Json Deserialize Python
In cases of DateTime please use local machine timezone or UTC timezone of 'Z'.This is how dates should be formatted from DateTime and DateTimeOffset.' Fff'Z'I can't tell you how much it pains me to see all these different so called ISO formats in the.NET framework that don't really reflect reality.
To clarify my comment from above, the only DateTime formatter that follows ISO 8601 is 'o'. But the industry as a whole, as pretty much settled on millisecond resolution for the DateTime format, mostly because this is the resolution of UNIX time.It would be great if Microsoft also supported this.yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'
Fffffffzzz (this is the 'o' format, which is ISO 8601)yyyy'-'MM'-'dd'T'HH':'mm':'ss'.' Fff'Z' (this is the industry standard ISO 8601 format)It would save me a lot of time trying to create the most usable API across web clients, if Microsoft out of the box just supported this second format.Thanks. Yes, dates are really hard. The worst part is that most developers think that because its in the BCL that DateTime is perfect.
There are a few guys trying to do something about it, by re-implementing java's 'joda' project as pure.net. Check out Jon Skeet's post about 'Noda Time' DataContractJsonSerializer is pretty bad with JSON Dates.
Scott,One more pet peeve. Entity Framework returns DateTimes back as DateTimeKind.Unspecified. I save all of my DateTimes to the DB in UTC, but if the JSON serializer sees DateTimeKind.Unspecified, it figures it is local time and again, converts to UTC for a JSON Date(xxxxx) response. The result is double hour shifting!I wrote a T4 template that forces all retrieved DateTime objects from the DB to come back as DateTimeKind.UTC by default, but a simple config file flag to force EF to return them UTC, built in, would be A-W-E-S-O-M-E.My blog post on this: http://www.aaroncoleman.net/post/2011/06/16/Forcing-Entity-Framework-to-mark-DateTime-fields-at-UTC.aspx-Aaron.