Keep the way you're serializing the querysets, add each one to a
dictionary, and then:
return dict((k, simplejson.dumps(v)) for k, v in ret_val.iteritems())
-Jeff
On Mar 6, 10:49 am, Marek Wawrzyczek wrote:
> Thanks for your responses, they helped :)
>
> In the code below:
>
> ret['b']
Thanks for your responses, they helped :)
In the code below:
ret['b'] = State.objects.all()
print 'ret: %' % ret
try:
serialized = encoder.JSONEncoder().encode(ret)
except Exception, e:
print 'exception: %s' % e
I was do
You know what's weird? I've used simplejson.dumps() plenty of times
in my own code... not sure why that one just slipped out of my
memory. I should just stop responding to things :-)
Anyway, since you're serializing a model, you *should* be using your
originally posted method. Use the way Mare
Thomas Guettler wrote:
>
> Jeff FW schrieb:
>
>> The serializers are for serializing querysets/models. I'm surprised
>> you're not getting an error message there--are you catching all
>> exceptions?
>>
>> What you want is in django.utils.simplejson:
>>
>> from django.utils.simplejson import en
Jeff FW schrieb:
> The serializers are for serializing querysets/models. I'm surprised
> you're not getting an error message there--are you catching all
> exceptions?
>
> What you want is in django.utils.simplejson:
>
> from django.utils.simplejson import encoder
> encoder.JSONEncoder().encod
The serializers are for serializing querysets/models. I'm surprised
you're not getting an error message there--are you catching all
exceptions?
What you want is in django.utils.simplejson:
from django.utils.simplejson import encoder
encoder.JSONEncoder().encode(ret)
-Jeff
On Mar 4, 6:55 pm, M
Hello,
I've got the code like this:
from django.core import serializers
...
ret = { }
ret['a'] = 'b'
json_serializer = serializers.get_serializer("json")()
serialized = json_serializer.serialize(ret, ensure_ascii=False)
print serialized
and this doesn't print serial
7 matches
Mail list logo