如何查詢在bigquery表中存儲爲字符串的json? 我有一個表,其中一列(subscriptions
)值是這樣的:如何查詢在bigquery表中存儲爲字符串的json?
{
"data": [{
"application_fee_percent": null,
"canceled_at": null,
"created": 1500476240,
"items": {
"data": [{
"created": 1500476240,
"id": "s4nQMWJn4P1Lg",
"metadata": {},
"object": "subscription_item",
"plan": {
"amount": 3,
"created": 1494270926,
"currency": "usd",
"livemode": true,
"metadata": {
"currentlySelling": "true",
"features": "{\"shipping\": true,\"transactionFee\":0.00}",
"marketingFeatures": "[\"Unlimited products\"]"
},
"name": "Personal",
"object": "plan",
"statement_descriptor": null,
"trial_period_days": null
},
"quantity": 1
}],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/subscri3XwjA3"
},
"livemode": true,
"metadata": {
"test": "596f735756976"
},
"object": "suion",
"quantity": 1
}],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/cutions"
}
如何選擇application_fee_percent
,features
和marketingFeatures
?
對於created
,我試過 JSON_EXTRACT("subscriptions", "$.data[0].created")
但它返回null。
@米哈伊爾 - Berlyant這是跟進從昨天的問題。你能幫忙嗎? –
請注意:您可以使用@僅回覆已經參與帖子的SO用戶。否則 - 您的郵件沒有收到預期的收件人。只是閱讀更多關於SO的幫助來了解並更好地瞭解本網站的運作方式以及它周圍的規則。同時 - 我會檢查你的問題,然後回來:o) –
問題的一部分是你共享的JSON無效(嘗試粘貼到https://jsonlint.com/),所以它不可能使用'JSON_EXTRACT',除非轉錄過程中出現錯誤。 –