Update all the elements of JSON array nested in a JSON column (Postgres)
I think I worked it out. Something like:

SELECT my_column::jsonb ||
    jsonb_build_object('a',
            (SELECT json_agg(a::jsonb || jsonb_build_object('r','[]'::jsonb))
            FROM jsonb_array_elements(my_column-&gt;'a') a)
    )
FROM my_table;


Though this might not be perfect since I'm translating to this example without testing.