      field = serializers.JSONField()
  
  
  class TestBinaryJSONField(FieldValues):
      """
      Values for `JSONField` with binary=True.
      """
      valid_inputs = [
 
</s> remove             if self.binary:
 </s> add             if self.binary or getattr(data, 'is_json_string', False):
    def test_html_input_as_json_string(self):
        """
        HTML inputs should be treated as a serialized JSON string.
        """
        class TestSerializer(serializers.Serializer):
            config = serializers.JSONField()

        data = QueryDict(mutable=True)
        data.update({'config': '{"a":1}'})
        serializer = TestSerializer(data=data)
        assert serializer.is_valid()
        assert serializer.validated_data == {'config': {"a": 1}}

      field = serializers.JSONField()
  
    def test_html_input_as_json_string(self):
        """
        HTML inputs should be treated as a serialized JSON string.
        """
        class TestSerializer(serializers.Serializer):
            config = serializers.JSONField()

        data = QueryDict(mutable=True)
        data.update({'config': '{"a":1}'})
        serializer = TestSerializer(data=data)
        assert serializer.is_valid()
        assert serializer.validated_data == {'config': {"a": 1}}

  
  class TestBinaryJSONField(FieldValues):
      """
      Values for `JSONField` with binary=True.
      """
      valid_inputs = [
keep add keep keep keep keep keep keep
 When HTML form input is used with JSONField, treat the input as a JSON encoded string, not a JSON primative. (#4565) 
tests/test_fields.py