PostgreSQL: Combine two JSON objects into a single JSON object
I am using PostgreSQL 15 and have the following two statements in PL/pgSQL: -- Statement 1 SELECT to_json(T) FROM (SELECT * FROM category WHERE category.id = 43) T) -- Statement 2 SELECT json_build_object('products', JSON_AGG(T)) FROM (SELECT * FROM product WHERE…