Postgresql Select Rows As Json File