Results of query as tuple value

Hello,

I want to query a table, aggregate all the results and assign them to a tuple field. Basically, I want to get the equivalent to this JSON:

{
  "bananas": [
    {
      "field1": 1,
      "field2": 1
    },
    {
      "field1": 2,
      "field2": 2
    },
    {
      "field1": 3,
      "field2": 3
    }
  ]
}

Each object inside the list would correspond to a row of the query result. 

How do I do this? If there's more than one approach, I would like to know them. :)

Cheers,
Luis

(1) Answer

Login