ASP.NET MVC JsonResult Date Format

前端 未结 25 3330
渐次进展
渐次进展 2020-11-21 11:22

I have a controller action that effectively simply returns a JsonResult of my model. So, in my method I have something like the following:

return new JsonRes         


        
25条回答
  •  时光取名叫无心
    2020-11-21 11:51

    See this thread:

    http://forums.asp.net/p/1038457/1441866.aspx#1441866

    Basically, while the Date() format is valid javascript, it is NOT valid JSON (there is a difference). If you want the old format, you will probably have to create a facade and transform the value yourself, or find a way to get at the serializer for your type in the JsonResult and have it use a custom format for dates.

提交回复
热议问题