Created
December 11, 2015 01:34
-
-
Save edgabaldi/aa91d27e104d5acb10c7 to your computer and use it in GitHub Desktop.
JSON Serialize Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import json | |
>>> import datetime | |
>>> from django.core.serializers.json import DjangoJSONEncoder | |
>>> di = {'now': datetime.datetime.now()} | |
>>> json.dumps(di, cls=DjangoJSONEncoder) | |
'{"now": "2015-12-10T23:32:42.344"}' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment