I tried at least a hundred combinations,including json_build_object and json_build_array, but no matter what I did, I always ended up with the name of the TYPE variables ("ckey" and c"value") in my JSON string. I tried to simply by doing:
CREATE TYPE qsn_app.key_value_pair AS(ckey text, cvalue text);
CREATE TYPE qsn_app.key_value_pair_tab as (kv key_value_pair[]);