I have a table defined as follows:
CREATE TABLE data_table AS ( id bigserial, "name" text NOT NULL, "value" text NOT NULL, CONSTRAINT data_table_pk PRIMARY KEY (id) ); INSERT INTO data_table ("name", "value") VALUES ('key_1', 'value_1'), ('key_2', 'value_2');
I would like to get a JSON object from this table content, which would look like this:
{ "key_1":"value_1", "key_2":"value_2" }
Now I am using a client application to analyze a result set in JSON format. Is it possible to accomplish this using a postgresl request?
Przemek
source share