title: Angular2 JSON.stringify
body: <p>Why Angular2 override JSON.stringify !?</p>
  
  <p>I have override my own Date.toJSON but it's not called when stringify an object.</p>
  
  <p>In the following exemple it's work correctly, but it doesn't work in Angular App !</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
    
    &lt;body&gt;
      
      Custom Date Fomat : &lt;span id="date1"&gt;&lt;/span&gt;&lt;br&gt;
      ISO Date Format : &lt;span id="date2"&gt;&lt;/span&gt;
    
    &lt;/body&gt;
    
    &lt;script&gt;
      Date.prototype.toJSON = function(){
        var day = date.getDate();
        var month = date.getMonth() + 1;
        var year = date.getFullYear();
  
        var s =  year + "-" + 
          (month &gt; 9 ? "" : "0") + month + "-" + 
          (day   &gt; 9 ? "" : "0") + day   + "T00:00:00.000Z";
  
        return s;
      }
    
      var date = new Date();
      document.getElementById("date1").innerHTML = JSON.stringify({date});
      document.getElementById("date2").innerHTML = date.toISOString();
    
    &lt;/script&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>