Currently I have a table my_table with columns (id,product_id,text) and transform data into a json object like so:
SELECT
json_agg(
json_build_object(
'id', t.id,
'parent_id', t.product_id,
'text', t.text
)
)
FROM my_table AS t
Now that I am adding more columns to my_table, I need to return a JSON object per each row from the selected list of rows from this table.
Basically, talbe columns will be (id,product_id,text1,text2,text3)
And I want to return 3 identical objects with 1 different value of text (for text1,text2,text3)
How can I achieve this?