Created
April 23, 2013 19:23
-
-
Save squishybear-zz/5446582 to your computer and use it in GitHub Desktop.
Try to override the DjangoJSONEncoder.
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
from django.core.serializers import json | |
class MyClass(json.DjangoJSONEncoder): | |
def default(self, o): | |
return o + 5 | |
json.dumps([1, 2, 3], cls=MyClass) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment