I need a serializer for something like this:
{
\"items\": {
12: {
\"name\": \"item 1\"
},
66: {
\"name\": \"i
There is a ListField in django rest framework 3, you can check documentation here http://www.django-rest-framework.org/api-guide/fields/#listfield
For your example you can do something like this:
class ItemSerializer(serializers.Serializer):
id = serializers.IntegerField()
name = serializers.CharField()
class ItemsSerializer(serializers.Serializer):
items = serializers.ListField(child=ItemSerializer())
The later serializer can be also:
class ItemsSerializer(serializers.Serializer):
items = ItemSerializer(many=True)