I need to convert some element in jsonb column to array
What I have:
{"a": {
"b": "2022-11-03",
"c": "321321",
"d": "213321"
}
}
What I need: `
{"a": [
{
"b": "2022-11-03",
"c": "321321",
"d": "213321"
}
]
}
you can use jsonb_set()
for this:
SELECT jsonb_set(the_column, '{a}', jsonb_build_array(the_column -> 'a'))
FROM the_table