> > Your idea of overriding the Serializer class sounds like a better idea to me. > It should be possible (and will be interesting) ,I'll think I'll look into > that tonight.
Overwriting django's default serializers is possible. This is how I've done it: In the root of my django project: mkdir serializers touch serializers/__init__.py create serializers/json.py and add the following (I've just removed the pk and model fields which I don't like , but can of course be modified to your liking) from django.core.serializers.python import Serializer as PythonSerializer class Serializer(PythonSerializer): def end_object(self, obj): self.objects.append({ "fields" : self._current }) self._current = None I've only tested this interactively but it seems to work In [15]: from serializers.json import Serializer as JsonSerializer In [16]: json_serializer = JsonSerializer() In [17]: json_serializer.serialize(Item.objects.all()) Out[17]: [{'fields': {'name': u'foobar'}}] -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.