I have a table with a single jsonb column. How do I perform a select query that transforms each jsonb row into a jsonb array where each item is another array with the first index being the key and the second index being the value? The keys are not known ahead of time.
Selecting the column with this query:
SELECT myRow FROM myTable
returns rows with the following jsonb values:
{
"key1": "value1",
"key2": "value2",
"key3": "value3",
"key4": "value4",
"key5": "value5"
}
I want the output rows to look like this:
[
["key1", "value1"],
["key2", "value2"],
["key3", "value3"],
["key4", "value4"],
["key5", "value5"]
]