title: Is there a way to return DateTime in ISO format from a asp .net web method instead of JSON format?
body: <p>Currently the web methods or most of the methods in classic asp .net serializes using <em>system.web.script.serialization.javascriptserializer</em> class and this returns the javascript object's datetime members with values such as </p>
  
  <blockquote>
    <p>"/Date(number of ticks)/"</p>
  </blockquote>
  
  <p>. I understand this is an infamous problem and most people suggest using some kind of converters after we receive the data or return the data as string instead of objects.</p>
  
  <p>For example the class </p>
  
  <pre><code>public class Person
  {
      public String Name { get; set; }
      public int Age { get; set; }
      public DateTime DOB { get; set; }
  }
  </code></pre>
  
  <p>if returned via a System.Web.Services.WebMethod with a [ScriptMethod(ResponseFormat = ResponseFormat.Json)] decoration, the response will be returned as below in result.d</p>
  
  <pre><code>{Name:"Steve", Age:30, DOB:"/Date(1249335477787)/"};
  </code></pre>
  
  <p>And we need to apply some code to convert the DOB into ISO format or some other acceptable format.</p>
  
  <p>But I am just trying to see if some one has done some kind of response tweaking or using an over-ridden class to return the DateTime values from web methods. Is there a way to over-ride the javascriptserializer's functionality and use it in asp .net web methods so that it returns the date directly in <strong>ISO</strong> format? I am aware that it can be done in asp .net MVC in a few ways. </p>
  
  <p>Is the same can be done in asp .net web form's web methods? That would save a lot of code and bugs as well :)</p>