This answer shows how to collapse several columns per group to one array of key:value pairs.
friends_map:
=================================
user_id friend_id confirmed
=================================
1 2 true
1 3 false
2 1 true
2 3 true
1 4 false
SELECT user_id, array_agg((friend_id, confirmed)) as friends
FROM friend_map
WHERE user_id = 1
GROUP BY user_id
returns
user_id | friends
--------+--------------------------------
1 | {"(2,true)","(3,false)","(4,false)"}
My question
How to go the other way around, from the result table back to the initial table?