          List of object instances -> List of dicts of primitive datatypes.
          """
          return [self.child.to_representation(item) if item is not None else None for item in data]
  
  
  class DictField(Field):
      child = _UnvalidatedField()
      initial = {}
      default_error_messages = {
          'not_a_dict': _('Expected a dictionary of items but got type "{input_type}".')
 
</s> remove         return [self.child.run_validation(item) for item in data]
 </s> add         return self.run_child_validation(data) </s> remove         return {
            six.text_type(key): self.child.run_validation(value)
            for key, value in data.items()
        }
 </s> add         return self.run_child_validation(data) </s> remove         ([1, 2, 'error'], ['A valid integer is required.']),
 </s> add         ([1, 2, 'error', 'error'], {2: ['A valid integer is required.'], 3: ['A valid integer is required.']}), </s> remove         ({'a': 1, 'b': None}, ['This field may not be null.']),
 </s> add         ({'a': 1, 'b': None, 'c': None}, {'b': ['This field may not be null.'], 'c': ['This field may not be null.']}),
    def run_child_validation(self, data):
        result = []
        errors = OrderedDict()

        for idx, item in enumerate(data):
            try:
                result.append(self.child.run_validation(item))
            except ValidationError as e:
                errors[idx] = e.detail

        if not errors:
            return result
        raise ValidationError(errors)

          List of object instances -> List of dicts of primitive datatypes.
          """
          return [self.child.to_representation(item) if item is not None else None for item in data]
  
    def run_child_validation(self, data):
        result = []
        errors = OrderedDict()

        for idx, item in enumerate(data):
            try:
                result.append(self.child.run_validation(item))
            except ValidationError as e:
                errors[idx] = e.detail

        if not errors:
            return result
        raise ValidationError(errors)

  
  class DictField(Field):
      child = _UnvalidatedField()
      initial = {}
      default_error_messages = {
          'not_a_dict': _('Expected a dictionary of items but got type "{input_type}".')
keep keep keep add keep keep keep keep keep keep
 Improve composite field child errors (#5655)

* Fixup DictField test descriptions

* Nest ListField/DictField errors under the idx/key

* Add nested ListField/DictField tests 
rest_framework/fields.py