In Django : How to serialize dict object to json ?
Posted
by Rohit
on Stack Overflow
See other posts from Stack Overflow
or by Rohit
Published on 2010-06-10T00:34:25Z
Indexed on
2010/06/10
0:42 UTC
Read the original article
Hit count: 340
I have this very basic problem,
>>> serializers.serialize("json", {'a':1})
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/lib/pymodules/python2.6/django/core/serializers/__init__.py", line 87, in serialize
s.serialize(queryset, **options)
File "/usr/lib/pymodules/python2.6/django/core/serializers/base.py", line 40, in serialize
for field in obj._meta.local_fields:
AttributeError: 'str' object has no attribute '_meta'
>>>
How can this be done ? Thanks in advance !
© Stack Overflow or respective owner