PostgreSQL return result set as JSON array?
I would like to have PostgreSQL return the result of a query as one JSON array. Given create table t (a int primary key, b text); insert into t values (1, ‘value1’); insert into t values (2, ‘value2’); insert into t values (3, ‘value3’); I would like something similar to [{“a”:1,”b”:”value1″},{“a”:2,”b”:”value2″},{“a”:3,”b”:”value3″}] or {“a”:[1,2,3], “b”:[“value1″,”value2″,”value3”]} (actually … Read more