I would like to have psql return result as json with the following format example:
{
"2021-10-27" : 324,
"2021-10-26" : 14,
"2021-10-28" : 24,
"2021-10-30" : 4,
}
My SQL is :
SELECT DATE(user.updated_at), COUNT(*)
FROM users AS user
GROUP BY DATE(user.updated_at)
How can I return the above SQL as json. I use psql version 13.
Thanks.