=# select '[1,2,3]' :: jsonb :: int[];
I think would be useful, cast int[] to json is not hard
select to_json('{1,5,9,12}'::int[]);
but json array to int[] is not that easy.
select js,
js->'items',
translate(js->>'items','[]','{}')::int[],
5 = any(translate(js->>'items','[]','{}')::int[])
--This one would be cool, doesn't need translate or any other trick
--5 = any(js->'items'::int[])
from (select jsonb_build_object('items','{1,5,9,12}'::int[])) x(js);
So, if you cast one way, you can do both ways.
regards
Marcos