I have a table of data with and id column and a jsonb column with object data:
id (int) data (jsonb)
I'm querying the data like this
select row_to_json(t)
from (
select id, data from accounts
) t;
which gets me data that looks like this:
{
"id":3,
"data":
{
"emailAddress": "[email protected]",
"mobileNumbers": ["5559991212"]
}
}
I would like to merge the data field into the main record set, I basically want the keys in the data node into the main record:
{
"id":3,
"emailAddress": "[email protected]",
"mobileNumbers": ["5559991212"]
}