Django-rest-framework: aserializer.data returns ReturnDict and OrderedDict instead of dict object

I wrote a model class serializer for a model. When I check if it serializes correctly, I get the following error.

AssertionError: ReturnDict([(u'id', 1), ('apple', OrderedDict([(u'id', 1), ('data', u'this is a apple data.')])) ...

I tried converting it to dicter file aserializer.data for dict function like

dict(aserializer.data)

Then I get the following error.

AssertionError: {'status': False, 'http': OrderedDict([(u'id', 1), ...

How to get dictionary data from serializer.

+3
serialization django-rest-framework


source to share


No one has answered this question yet

Check out similar questions:

449
JSON.NET error Local binding loop for type
79
Django Rest Framework - How to add custom field to ModelSerializer
26
Django REST Framework - Serializing Optional Fields
five
Django Rest Framework writable nested serializer with multiple nested objects
1
Django REST Framework ManyToMany Error
1
How to use serializer in Django REST Framework
0
Django Restful: nested serializers
0
Django REST Framework: Nested Serializers and Deserialization
0
Django Rest Framework returns Dicts instead of OrderedDicts
0
Django REST framework with nested DictField in MongoDB



All Articles
Loading...
X
Show
Funny
Dev
Pics