I'm running PostgreSQL and are trying to convert this:
SELECT car_id AS id, car_model AS model FROM cars
into this:
[{ "id" : 123, "model" : "Fiat" }, {"id": 124, "model": "BMW"}, ...]
I've tried:
SELECT json_agg(
json_build_object(car_id AS id),
json_build_object(car_model AS model)
) FROM cars
and a lot other stuff, but seems to be stuck