@@ -548,10 +548,7 @@ def visit_bindparam(
548548bq_type = self .__remove_type_parameter (bq_type )
549549
550550if bq_type == "JSON" :
551- # FIXME: JSON is not a member of `SqlParameterScalarTypes` in the DBAPI
552- # For now, we hack around this by:
553- # - Rewriting the bindparam type to STRING
554- # - Applying a bind expression that converts the parameter back to JSON
551+
555552bq_type = "STRING"
556553
557554assert_ (param != "%s" ,f"Unexpected param:{ param } " )
@@ -649,6 +646,14 @@ def visit_NUMERIC(self, type_, **kw):
649646visit_DECIMAL = visit_NUMERIC
650647
651648def visit_JSON (self ,type_ ,** kw ):
649+ if isinstance (
650+ kw .get ("type_expression" ),sqlalchemy .sql .expression .BindParameter
651+ ):# bindparam
652+ # FIXME: JSON is not a member of `SqlParameterScalarTypes` in the DBAPI
653+ # For now, we hack around this by:
654+ # - Rewriting the bindparam type to STRING
655+ # - Applying a bind expression that converts the parameter back to JSON
656+ return "STRING"
652657return "JSON"
653658
654659