title: Using DRF serializer to validate a list of dictionaries
body: <p>How do I write a serializer that validates a list of dictionaries?</p>
  
  <p>Sample payload being sent is:</p>
  
  <pre><code>"payment_discount": [
      {
          "discount_rule_id": 1,
          "discount_rule_name": "10 day early payment",
          "discount_earned": "298.00"
      },
      {
          "discount_rule_id": 2,
          "discount_rule_name": "Store discount",
          "discount_earned": "5.50"
      },
  ]
  </code></pre>
  
  <p>Taking from <a href="https://stackoverflow.com/a/37629684/1082673">this SO answer</a> and <a href="https://stackoverflow.com/a/27739615/1082673">this</a>:</p>
  
  <pre><code>class PaymentDiscountSerializer(serializers.DictField):
  
      discount_rule_id = serializers.IntegerField(required=False)
      discount_rule_name = serializers.CharField(max_length=50)
      discount_earned = serializers.DecimalField(max_digits=10, decimal_places=3)
  
  class PaymentDiscountListSerializer(serializers.ListField):
      """Serialize discount object"""
      child = PaymentDiscountSerializer()
  
  class PaymentSerializer(serializers.ModelSerializer):
      payment_discount = PaymentDiscountListSerializer()
      # Other model fields
  </code></pre>
  
  <p>With this, I can get access to the payment_discount object in the payload using serializer.data but unfortunately no validations are being done against the dictionary if e.g. the payload includes discount_earned value of that is not of type Decimal</p>
  
  <p>using: Django==1.10.2 &amp; djangorestframework==3.5.1</p>