On 10/24/19 12:46 PM, Paul A Jungwirth wrote: > > 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. >
json{b}_build_object and json{b}_build_array are designed for creating nested json{b}. Not sure if they would work for your purpose. I hadn't considered something to let you transform keys. PLV8 is useful for doing more outlandish JSON transformations. Maybe the Underscore library has something that would be useful here. cheers andrew -- Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services