              six.text_type(key): self.child.to_representation(val) if val is not None else None
              for key, val in value.items()
          }
  
  
  class JSONField(Field):
      default_error_messages = {
          'invalid': _('Value must be valid JSON.')
 
</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.']}), </s> remove     Values for `ListField` with CharField as child.
 </s> add     Values for `DictField` with CharField as child.
    def run_child_validation(self, data):
        result = {}
        errors = OrderedDict()

        for key, value in data.items():
            key = six.text_type(key)

            try:
                result[key] = self.child.run_validation(value)
            except ValidationError as e:
                errors[key] = e.detail

        if not errors:
            return result
        raise ValidationError(errors)

              six.text_type(key): self.child.to_representation(val) if val is not None else None
              for key, val in value.items()
          }
  
    def run_child_validation(self, data):
        result = {}
        errors = OrderedDict()

        for key, value in data.items():
            key = six.text_type(key)

            try:
                result[key] = self.child.run_validation(value)
            except ValidationError as e:
                errors[key] = e.detail

        if not errors:
            return result
        raise ValidationError(errors)

  
  class JSONField(Field):
      default_error_messages = {
          'invalid': _('Value must be valid JSON.')
keep keep keep add 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