#3564: flexible JSON serializing mechanism
--------------------------------+-------------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: jacob
Status: new | Component: Serialization
Version: SVN | Keywords:
Stage: Unreviewed | Has_patch: 0
--------------------------------+-------------------------------------------
JSON serialization is rather awkward in django, since you either have to
extract all the data in the view code och make your own JSON encoder. I
suggest adding a new class DjangoJSONEncoder (which extends
DateTimeAwareJSONEncoder) that will do essentially this:
def default(self, o):
try:
return o.json_serialize()
except AttributeError:
return super(self, DateTimeAwareJSONEncoder).default(o)
This way I can put the JSON serialization where it belongs: with my
models.
--
Ticket URL: <http://code.djangoproject.com/ticket/3564>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---