PostgreSQL – Column to Json/Jsonb I have a table coso_nhayen like this row_to_json select row_to_json(row) from (select * from coso_nhayen) row LIMIT 5; to_jsonb SELECT id, to_jsonb(t.*) – 'id' AS data FROM coso_nhayen t LIMIT 5; json_agg SELECT json_agg(t) FROM coso_nhayen t; […]