SELECT json_agg(t) FROM t
for a JSON array of objects, and

SELECT
    json_build_object(
        'a', json_agg(t.a),
        'b', json_agg(t.b)
    )
FROM t
Categories: postgres

0 Comments

Leave a Reply

Your email address will not be published.