i have a custom response from which that i need to get specific informations like dayIndex , startTime and endTime from . The following data is part of column called response from this table :
The json response looks like this :
{"data":{"getMenusByStoreId":
[{"__typename":"MenuSimple",
"id":"13773951",
"isActive":true,
"isBusinessEnabled":null,
"isCatering":null,
"merchantSuppliedId":null,
"name":"Alyssas Dessert Bar (All Day) (6th Street) 06.13.22 “,
"openHours":[{
"__typename":"OpenHours",
"dayIndex":0,
"endTime":"02:00:00",
"startTime":"00:00:00"
},{
"__typename":"OpenHours",
"dayIndex":1,
"endTime":"02:00:00",
"startTime":"00:00:00"
},{
"__typename":"OpenHours",
"dayIndex":2,
"endTime":"02:00:00",
"startTime":"00:00:00"
},{
"__typename":"OpenHours",
"dayIndex":3,
"endTime":"02:00:00",
"startTime":"00:00:00"
},{
"__typename":"OpenHours",
"dayIndex":4,
"endTime":"02:00:00",
"startTime":"00:00:00"
},{
"__typename":"OpenHours",
"dayIndex":5,
"endTime":"02:00:00",
"startTime":"00:00:00"
},{
"__typename":"OpenHours",
"dayIndex":6,
"endTime":"02:00:00",
"startTime":"00:00:00"
},{"__typename":"OpenHours","dayIndex":0,"endTime":"23:59:59","startTime":"11:00:00"},{"__typename":"OpenHours","dayIndex":1,"endTime":"23:59:59","startTime":"11:00:00"},{"__typename":"OpenHours","dayIndex":2,"endTime":"23:59:59","startTime":"11:00:00"},{"__typename":"OpenHours","dayIndex":3,"endTime":"23:59:59","startTime":"11:00:00"},{"__typename":"OpenHours","dayIndex":4,"endTime":"23:59:59","startTime":"11:00:00"},{"__typename":"OpenHours","dayIndex":5,"endTime":"23:59:59","startTime":"11:00:00"},{"__typename":"OpenHours","dayIndex":6,"endTime":"23:59:59","startTime":"11:00:00"}],"sourceOfCreation":null,"subtitle":"All Day"}]}}
Iam trying to normalize the table to look like this:
How to flatten the json into columns as the example above, using SQL in bigquery? (The script will be running from dbt, but for now, I am just trying to get a valid query to run)
I should add that the actual json has far more fields, they might change, and I expect null values for some things