SPA, JSON, Datetime madnesshttp://forums.asp.net/t/1779716.aspx/1?SPA+JSON+Datetime+madnessThu, 29 Mar 2012 01:14:40 -040017797164877166http://forums.asp.net/p/1779716/4877166.aspx/1?SPA+JSON+Datetime+madnessSPA, JSON, Datetime madness <p>Hi,</p> <p>Since changing the serialization to JSON.net&nbsp;like blogged about (<a title="Scott Hanselman" href="http://www.hanselman.com/blog/CommentView.aspx?guid=1b713651-3ad4-41e7-9d85-354f227ddd57">Scott Hanselman</a>, <a title="Rick Strahl" href="http://www.west-wind.com/weblog/posts/2012/Mar/09/Using-an-alternate-JSON-Serializer-in-ASPNET-Web-API?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A&#43;RickStrahl&#43;%28Rick&#43;Strahl%27s&#43;WebLog%29"> Rick Strahl</a> and <a title="Henrikn" href="http://blogs.msdn.com/b/henrikn/archive/2012/02/18/using-json-net-with-asp-net-web-api.aspx?tw_p=twt" target="_blank"> Henrikn</a>)&nbsp;</p> <p>I see normal JSON dates going over the wire but when persisting entities to the server I now get this issue.</p> <pre class="prettyprint">This DataController does not support operation 'Update' for entity 'JObject'</pre> <p>This issue is already on <a title="stackoverflow " href="http://stackoverflow.com/questions/9473714/mvc-4-single-page-application-and-datetime/9681171#comment12299639_9681171" target="_blank"> stackoverflow </a>but the answer didn't work for me.</p> <p>Does anybody has a solution by using a serializer instead of parsing it manually.</p> <p>Thanks in advance</p> 2012-03-13T09:42:00-04:004877957http://forums.asp.net/p/1779716/4877957.aspx/1?Re+SPA+JSON+Datetime+madnessRe: SPA, JSON, Datetime madness <p>I'm getting this too today..</p> <pre style="background:white; color:black; font-family:Consolas"><span style="color:green"> currently&nbsp;causes&nbsp;an&nbsp;exception&nbsp;in&nbsp;DbDataController&nbsp;Message=This&nbsp;DataController&nbsp;does&nbsp;not&nbsp;support&nbsp;operation&nbsp;'Insert'&nbsp;for&nbsp;entity&nbsp;'JObject'.</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:green">//StackTrace=&nbsp;&nbsp;&nbsp;at&nbsp;System.Web.Http.Data.DataController.ResolveActions(DataControllerDescription&nbsp;description,&nbsp;IEnumerable`1&nbsp;changeSet)</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:green">//at&nbsp;System.Web.Http.Data.DataController.Submit(ChangeSet&nbsp;changeSet)</span></pre> <p><span>and also another&nbsp;related issue I get, the symptoms are a valid model but a 400 Bad request is returned. Identified as '</span><span id="TitleLabel" class="CodePlexPageHeader">DateTime doesn't roundtrip correctly</span>' by someone in the MS team to JNK on the web.api. The issue has been supposedly&nbsp;'closed'&nbsp;but it is not clear whether it closed 'fixed' or closed this is 'just a feature'.</p> <pre style="background:white; color:black; font-family:Consolas"><span style="color:green"><a href="http://forums.asp.net/t/1776567.aspx/1?Json&#43;Net&#43;formatter&#43;per&#43;HF&#43;s&#43;blog&#43;and&#43;Bad&#43;request&#43;on&#43;post">http://forums.asp.net/t/1776567.aspx/1?Json&#43;Net&#43;formatter&#43;per&#43;HF&#43;s&#43;blog&#43;and&#43;Bad&#43;request&#43;on&#43;post</a></span></pre> <pre style="background:white; color:black; font-family:Consolas"><span style="color:green"></span></pre> <pre style="background:white; color:black; font-family:Consolas"><span style="color:green"></span></pre> 2012-03-13T15:14:56-04:004902805http://forums.asp.net/p/1779716/4902805.aspx/1?Re+SPA+JSON+Datetime+madnessRe: SPA, JSON, Datetime madness <p>I'm getting the same error. Any solutions?</p> 2012-03-28T03:29:09-04:004905014http://forums.asp.net/p/1779716/4905014.aspx/1?Re+SPA+JSON+Datetime+madnessRe: SPA, JSON, Datetime madness <p>Hmmm... I see no problem with straight ApiController methods (ie. no DataController) which receive complex types without a problem</p> <p>What is the code for the target method? Is the error occurring after the binding has occurred or somewhere else?</p> <p>It seems that this has something to do with the DataController/DbDataController class for SPA (?) applications maybe? I haven't looked at that yet, so I'm not sure what it does but it would appear that the framework is using a separate parsing mechanism that used to rely on JsonObject previously and now uses JObject instead which fails.</p> <p>Sounds like a bug in DataController which appears to be hardcoded to the stock serializers/JSON objects.</p> <p>Know this doesn't fix but may help shed some light on the issue.</p> <p>&#43;&#43;&#43; Rick ---</p> 2012-03-29T01:14:40-04:00