Re:Ask HN: The current state of DotNet Web development
by DamonOehlman on Tuesday December 14, 2010 @01:51AM
(#2003382)
How "pure" is the JSON generated using the out of the box serializer? I guess what I'm asking is there much MS cruft in there or does it look pretty clean?
Re:Ask HN: The current state of DotNet Web development
by Encosia on Tuesday December 14, 2010 @01:56AM
(#2003396)
Completely clean...
Except for DateTime types. Since it uses JavaScriptSerializer under the hood, Json() serializes DateTime values as \/Date(ticks)\/. That, of course, is more the fault of JavaScript lacking a Date literal than Microsoft's serializer. Everyone has to solve that problem some way or another.
Exposing your models as RESTful endpoints that return JSON is still accomplished easily enough easy via controller actions that return JsonResult. You can return any object that JavaScriptSerializer can serialize by simply using `return Json(object);`.