          value = self.value
          # When HTML form input is used and the input is not valid
          # value will be a JSONString, rather than a JSON primitive.
          if not getattr(value, 'is_json_string', False):
              try:
                  value = json.dumps(
                      self.value,
                      sort_keys=True,
                      indent=4,
                      separators=(',', ': '),
 
</s> remove             except AttributeError:
                pass

 </s> add  </s> remove             try:
 </s> add             with contextlib.suppress(AttributeError): </s> remove             except (TypeError, ValueError):
                pass
 </s> add  </s> remove             try:
 </s> add             with contextlib.suppress(FieldDoesNotExist): </s> remove         except TypeError:  # Input is an unhashable type
            pass
 </s> add 
            with contextlib.suppress(TypeError, ValueError):
          value = self.value
          # When HTML form input is used and the input is not valid
          # value will be a JSONString, rather than a JSON primitive.
          if not getattr(value, 'is_json_string', False):
            with contextlib.suppress(TypeError, ValueError):
                  value = json.dumps(
                      self.value,
                      sort_keys=True,
                      indent=4,
                      separators=(',', ': '),
keep keep keep keep replace keep keep keep keep keep
 Refactor: Replace try/except with contextlib.suppress() (#8676) 
rest_framework/utils/serializer_helpers.py