I have json column with data that looks like this:
CREATE TABLE foo(mycol)
AS SELECT $${
"a": [
{ "q": 5 },
{ "q": 8 },
{ "q": 10 }
]
}$$::jsonb;
I'd like to map over the elements in the array and add an extra property to get something like this:
{
a: [
{ q: 5, r: [] },
{ q: 8, r: [] },
{ q: 10, r: [] }
]
}
Any and all would be greatly appreciated.
PostgreSQL 9.6.6