Extract JSON array of numbers from JSON array of objects
You need to first unnest the array elements, and then aggregate back each value:

select id, 
       (select jsonb_agg(t -&gt; 'a') from jsonb_array_elements(record) as x(t)) as record
from the_table;


Online example: https://rextester.com/ZONHTW97204