In a bit of a pickle at work - I have a Jsonb which I need to flatten a file that has similar structure:
{
"Manufacturers":[
{
"manufacturer":"Tesla",
"address":"Deer Creek Road Palo Alto",
"contact":"support@tesla.com"
},
{
"manufacturer":"BMW",
"address":"Petuelring 130, 80809 München",
"contact":"support@bmw.com"
}
]
I want this in a table format where manufacturing are column names! Something like this - Postgres JSONB - Flatten nested objects and groupings! Can't seem to understand how to get there. He has mentioned using jsonb_to_recordset
but not sure how to get everything in a typical csv format.
Example of how I want to see the data -
name
is an array so in theory could have multiple objects, do you want that as a separate table, or to somehow correlate back tomanufacturer
in a single table?manufacturer
is an array as well. How do the array elements ofmanufacturer
andname
relate? What is the output you want from that example?ERROR: column t.jsoncolumn does not exist LINE 3: CROSS JOIN jsonb_to_recordset(t.jsonColumn->'Manufacturers')