>
> class Serializer(PythonSerializer):
> def end_object(self, obj):
> self.objects.append({
> "fields" : self._current
> })
> self._current = None
>
>
I've made a small mistake I was importing PythonSerializer while It should've
been JsonSerializer
C
>
> 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:
mkd
Hi !
I have written a small library that (among other transformations) can
serialize django objects to dict (then you can just use 'json' to make
your dict to a json string) :
Docs on readthedocs :
http://readthedocs.org/docs/any2any/en/latest/doc_pages/djangocast.html
Pypi page : http://pypi.py
On Thu, May 19, 2011 at 1:23 PM, Jonas Geiregat wrote:
> Hello,
> I'm also finding the built in serialization a bit overhead.
Me too! I use a simple HttpResponse subclass for generating JSON though:
from django.http import HttpResponse
from django.utils import simplejson
class JsonResponse(Htt
Hello,
I'm also finding the built in serialization a bit overhead. It puts to much
information in your JSON string that can be modified such as the PK field.
I often import json ( http://docs.python.org/library/json.html ) and serialize
the data myself before passing it to the render method.
Th
I'm trying to return some JSON from one of my views. My objects are
simple and I can get the built-in json serializer working, but wanted
a cleaner object when I deserialize in my webpage, i.e. I don't want
the pk or model entries. What is the best way to go about that? I
played around a little wit
6 matches
Mail list logo