How to convert nested list to object
<p>When I receive JSON data like </p>

<pre><code>[  
    {  
        "id":1,
        "name":"New Island",
        "residents":[  
            {  
                "name":"Paul",
                "age":"25"
            }
        ]
    },
    {  
        "id":2,
        "name":"One Nation",
        "residents":[  
            {  
                "name":"James",
                "age":"23"
            },
            {  
                "name":"Jessica",
                "age":"26"
            }
        ]
    }
]
</code></pre>

<p>drf deserializer makes it to list which contain OrderedDict</p>

<p>But I want to make it to list of class object.</p>

<p>Here are my django models</p>

<pre><code>class Country(models.Model):
    name = models.CharField(max_length=20)

class Resident(models.Model):
    name = models.CharField(max_length=20)
    country = models.ForeignKey('Country', related_name='residents')
</code></pre>

<p>Override the serializer methods that control transformation from primitive to internal <a href="http://www.django-rest-framework.org/api-guide/serializers/#overriding-serialization-and-deserialization-behavior" rel="nofollow">http://www.django-rest-framework.org/api-guide/serializers/#overriding-serialization-and-deserialization-behavior</a></p>

python django django-rest-framework