--Takes a json array to parse each elements as text .But it shows an error. --Change the type from json[] to json but not helps.
CREATE OR REPLACE FUNCTION public.test(in_param json[])
RETURNS integer
LANGUAGE 'plpgsql'
COST 100
VOLATILE
AS $BODY$
declare
item text;
arr1 text[];
begin
for item in select * from json_array_elements_text(in_param ) loop
arr1 = arr1||item;
end loop;
return 0;
end;
$BODY$;
ALTER FUNCTION public.test(json[])
OWNER TO postgres;