SQL,解析 json

Google BigQuery数据库的data表存储了若干多层的Json串,其中一条形如:
[{"active":true,"key":"key1","values":[{"active":true,"value":"value1"}]},{"active":true,"key":"key2","values":[{"active":true,"value":"value2"}]}]
现在要解析json,取出values.values所有的值,即:value1,value2

编写SPL代码:


A

1

=bigQuery1.query("select jsonfield from data where id=1")

2

=json(A1.jsonfield).(values.value)

A1:执行简单SQL,取出json

A2:解析多层json,取出所有的values.value

来源:https://stackoverflow.com/questions/78427141/bigquery-extract-one-attribute-across-a-json-array-of-json-objects