Возвращает json объект
select json_object( array_agg("id")::text[] , array_agg("name")::text[] ) from "cities" /* { "1": "Moscow", "2": "Kazan" } */