我正在尝试将 JSON 列中的数据与表中的其他数据一起取消嵌套到单独的行中。这是我目前所拥有的......
Select
*,
items
from
project.mytable as libraries,
unnest ( libraries.items )
This is the JSON in the "items" column:
{
"254718f4-e4f4-40b2-83fd-24ca0c7d96b6": {
"createdAt": "2020-03-23T18:57:06.820Z",
"id": "254718f4-e4f4-40b2-83fd-24ca0c7d96b6",
"parameters": {
"name": "Access Topics (Webex)",
"resourceId": "96fae4ec-a448-440b-8faa-badba789417a",
"type": "video"
},
"type": "Resource",
"updatedAt": "2020-03-23T18:57:06.820Z"
},
"32a1084c-1cdf-4d15-b438-a3b79310d467": {
"createdAt": "2020-03-23T04:57:51.656Z",
"id": "32a1084c-1cdf-4d15-b438-a3b79310d467",
"parameters": {
"name": "Launch Update.mp4",
"resourceId": "993dad8f-6e3c-466b-81d6-25ef5df2fcb1",
"type": "video"
},
"type": "Resource",
"updatedAt": "2020-03-23T04:57:51.655Z"
}
}
您如何取消 json 的根项,以便您可以单独定位字段并将它们保存为 BQ 表中的字段?