我在试图在邮政总局职能范围内将一阵列或目标排入另一阵列时遇到一个问题。 看来,阵列——申请功能正在将JSON作为扼杀,导致产出出现出乎意料的形式。
目前,我正在取得这样的成果:
{"{"category_id":8,"category_name":"08 Candy","is_active":true,"category_name_app":"Candy","display_order":7}"} However, I d like the output to be in this format so that I can easily decode it in my code:
[}
我的职能逻辑如下:
for all_categories in select * from categories where is_active = 1 loop
show_at_homepage = 0;
for current_subcat in select * from public."V_category_to_sub_category_w_names" where category_id = all_categories.category_id and sub_category_is_active = 1 loop
select * into product_count from public."V_APP_products_w_sub_categories" where sub_category_id = current_subcat.sub_category_id and store_id = get_store_id and is_deleted= 0 ;
if count(product_count) > 0 then
show_at_homepage = 1;
end if;
end loop;
if show_at_homepage = 1 then
select row_to_json(all_categories) into cat_json;
select array_append(my_json_result_array,cat_json) into my_json_result_array;
end if;
end loop;
return my_json_result_array;