Is there a function in BigQuery to create a typed STRUCT
from a JSON
object? Here is an example of what I'm trying to do:
with tbl as (
SELECT
STRUCT<name STRING, age INT64>("Bob", 20) AS person_as_struct,
JSON '{"name": "Bob", "age": 20}' AS person_as_json
)
select
-- STRUCT -> JSON
TO_JSON(person_as_struct).age
-- JSON -> STRUCT
-- ???
from tbl