title: datetime.date(2014, 4, 25) is not JSON serializable in Django
body: <p>EDIT</p>
  <p>This question is not a duplicate of <a href="https://stackoverflow.com/questions/11875770/how-to-overcome-datetime-datetime-not-json-serializable">How to overcome &quot;datetime.datetime not JSON serializable&quot;?</a>
  Because, although this is the same problem, it provides a specific context: Django. And so, there are some solutions that apply here and that do not apply on the provided link's question.</p>
  <hr />
  <p>ORIGINAL QUESTION</p>
  <p>I followed <a href="https://stackoverflow.com/questions/11875770/how-to-overcome-datetime-datetime-not-json-serializable-in-python">How to overcome &quot;datetime.datetime not JSON serializable&quot;?</a> but this is not helping</p>
  <p>I tried this code</p>
  <pre><code>&gt;&gt;&gt; import datetime
  &gt;&gt;&gt; a =datetime.date(2014, 4, 25)
  &gt;&gt;&gt; from bson import json_util
  &gt;&gt;&gt; b = json.dumps(a,default = json_util.default)
  Traceback (most recent call last):
    File &quot;&lt;console&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;/usr/lib/python2.7/json/__init__.py&quot;, line 250, in dumps
      sort_keys=sort_keys, **kw).encode(obj)
    File &quot;/usr/lib/python2.7/json/encoder.py&quot;, line 207, in encode
      chunks = self.iterencode(o, _one_shot=True)
    File &quot;/usr/lib/python2.7/json/encoder.py&quot;, line 270, in iterencode
      return _iterencode(o, 0)
    File &quot;/home/.../python2.7/site-packages/bson/json_util.py&quot;, line 256, in default
      raise TypeError(&quot;%r is not JSON serializable&quot; % obj)
  TypeError: datetime.date(2014, 4, 25) is not JSON serializable
  </code></pre>
  <p>Can somebody help me with a <code>datetime.date</code> serializer and deserializer.</p>