Reputation: 1
I have a table (Uber Eats) containing JSON data within the response column.
JSON Structure
I have to parse the JSON data from the UberEats table using the response column in BigQuery using SQL.
Only JSON parsing
Table Name : arboreal-vision-339901.take_home_v2.virtual_kitchen_ubereats_hours
i tried below query
SELECT
JSON_EXTRACT_SCALAR(response, '$.uuid') AS UberEats_slug,
JSON_EXTRACT_SCALAR(response, '$.sections[0].regularHours[0].daysBitArray') AS UberEats_days_bit_array,
JSON_EXTRACT_SCALAR(response, '$.sections[0].regularHours[0].startTime') AS UberEats_opening_time,
JSON_EXTRACT_SCALAR(response, '$.sections[0].regularHours[0].endTime') AS UberEats_closing_time
FROM
`arboreal-vision-339901.take_home_v2.virtual_kitchen_ubereats_hours`
LIMIT 1000;
RESULT : all columns contains null value
also this query
SELECT
JSON_EXTRACT_SCALAR(response, '$.menus[*].uuid') AS UberEats_slug,
JSON_EXTRACT_SCALAR(response, '$.menus[*].sections[0].regularHours[0].daysBitArray') AS UberEats_days_bit_array,
JSON_EXTRACT_SCALAR(response, '$.menus[*].sections[0].regularHours[0].startTime') AS UberEats_opening_time,
JSON_EXTRACT_SCALAR(response, '$.menus[*].sections[0].regularHours[0].endTime') AS UberEats_closing_time
FROM
`arboreal-vision-339901.take_home_v2.virtual_kitchen_ubereats_hours`
LIMIT 1;
Error:
Unsupported operator in JSONPath: *; error in JSON_EXTRACT_SCALAR expression
Upvotes: 0
Views: 88