On Thu, Oct 24, 2019 at 8:45 AM Nikita Glukhov <n.glu...@postgrespro.ru> wrote: > You can simply use jsonb_object_agg() to build a jsonb object from a sequence > of transformed key-value pairs:
<strikes forehead> I've even used that function before. :-) I tried finding it on the JSON functions page but couldn't, so I thought maybe I was going crazy. Of course it's on the aggregates page instead. As I said it was late at night. :-) Your version works perfectly! Even still, it may be nice to have a non-aggregate function that lets you build nested JSON. But I agree jsonb_object_agg makes it less needful. Thanks! Paul