Try this:
create domain e as enum ('a', 'b');
select cast ('a' as e);
select json_array(cast('a' as e));
I would expect the query to produce ["a"], but it fails with:
SQL Error [22018] [22018]: Data conversion error converting "ENUM to JSON"
As a workaround, I can cast the enum value back to VARCHAR explicitly, but I think that should work out of the box?
select json_array(cast(cast('a' as e) as varchar));
Is there any other reasonable auto conversion from an enum value to a json value that I might be overlooking?