json - 如何提取在 BigQuery 中存储为字符串的 JSON 数组

标签 json google-bigquery

我有一个与此类似的 JSON 数组

[{"key":"Email","slug":"customer-email","value":"<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="debfbcbd9eb9b3bfb7b2f0bdb1b3" rel="noreferrer noopener nofollow">[email protected]</a>"},{"key":"Phone Number","slug":"mobile-phone-number","value":"123456789"},{"key":"First Name","slug":"first-name","value":"abc"},{"key":"Last Name","slug":"last-name","value":"xyz"},{"key":"Date of birth","slug":"date-of-birth","value":"01/01/1990"}]

但棘手的部分是,这个数组存储为字符串。所以我认为第一步是将字符串转换为数组,然后取消嵌套,然后按照 here 中的方法进行操作

我想知道这个方法是否可行,如果可以的话,我想我面临的挑战是将字符串转换为数组。如果没有,或者您有更有效的方法,请帮忙。谢谢

最佳答案

你尝试过json_extract_array

select json_extract_array(
  """[{"key":"Email","slug":"customer-email","value":"<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="54353637143339353d387a373b39" rel="noreferrer noopener nofollow">[email protected]</a>"},{"key":"Phone Number","slug":"mobile-phone-number","value":"123456789"},{"key":"First Name","slug":"first-  name","value":"abc"},{"key":"Last Name","slug":"last-name","value":"xyz"},{"key":"Date of birth","slug":"date-of-birth","value":"01/01/1990"}]""");

关于json - 如何提取在 BigQuery 中存储为字符串的 JSON 数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64167168/

相关文章:

java - 将 Json 日期转换为 java 日期

json - Inno 安装程序 : How can I edit and retrieve value from a children section of a JSON file

java - 是否可以在 Grails 操作中使用 Spring 的 @RequestBody?

json - "SyntaxError: Unexpected token U"使用node.js twitter 模块

google-cloud-platform - BigQueryIO - 流和 FILE_LOADS 的写入性能

javascript - 处理 Promise 的结果

google-bigquery - 查询失败错误 : Resources exceeded during query execution: The query could not be executed in the allotted memory

sql - 尝试使用 BigQuery 选择事件数据时出错

python - 在Python中捕获403禁止访问

sql - 大查询 : extract SECOND from TIMESTAMP