← Back to TIL

Get postgres query results as JSON

select jsonb_agg(row_to_json(t))
from (
	select * from <your table>
) t