title: Web Api 2 - custom data type JSON serialization
body: <p>I'm actually new to Web Api, so my question may sound a bit odd.</p>
  
  <p>I have simple API to return historical information about price changes. My controller's action looks like this:</p>
  
  <pre><code>[HttpGet]
  [Route("api/history/{id}/{size}")]
  public async Task&lt;IEnumerable&lt;PriceHistoryRecordModel&gt;&gt; GetHistory(string id, Size size)
  </code></pre>
  
  <p>where PriceHistoryRecordModel is</p>
  
  <pre><code>[DataContract]
  public class PriceHistoryRecordModel
  {
      [DataMember]
      public DateTime Date { get; set; }
  
      [DataMember]
      public double Value { get; set; }
  }
  </code></pre>
  
  <p>However, the problem is - action returns JSON in following format</p>
  
  <pre><code>[{"Date":"2016-02-07T08:22:46.212Z","Value":17.48},{"Date":"2016-02-08T09:34:01.212Z","Value":18.37}]
  </code></pre>
  
  <p>but, due to specific client requirements to data format, I need my JSON to look this way</p>
  
  <pre><code>[[1238371200000,17.48],[1238457600000,18.37]]
  </code></pre>
  
  <p>So, I wonder</p>
  
  <ul>
  <li>if there's a way to achieve such custom serialization?</li>
  <li>can I wrap this custom serialization in an attribute and use it as an aspect?</li>
  </ul>