When I want t to convert json array into postgres array, I do:
with t(j) as(
> select '{"my_arr":[3,1,2]}'::json
> )
> SELECT ARRAY(SELECT json_array_elements_text(j->'my_arr')) from tIt works like a charm and I never noticed any problem, but I'm asking here just to make sure, order of elements will be preserved always? Is that guaranteed in above example, or not? Thanks.
