简体   繁体   English

如何在 json bigquery 中获取特定单词后跟的确切短语

[英]How to get exact phrase followed by particular word in json bigquery

I've got such a column named X and I need to get the phase after word "name"我有这样一个名为 X 的列,我需要在单词“name”之后获取阶段

Here is an example of one row of json type:以下是 json 类型的一行示例:

{"id":"5df8c913e069a09e0467179e","name":"Contacts in description","vote":"REFUSE","notice":{"text":"Contacts or URLs in description are not allowed on JamesEdition","severity":"PROBLEM"},"wordHighlighting":[{"words":[{"word":"yes","regex":"/^yes$/"}],"variableName":"$text.hasUrl"}]}

So the result I need in this case is: Contacts in description Also sometimes there are several name in one string: I need to grab them all所以在这种情况下我需要的结果是: Contacts in description有时一个字符串中有多个name :我需要全部抓取

Thanks a lot for attention!非常感谢关注!

Try JSON_EXTRACT :尝试JSON_EXTRACT

SELECT JSON_EXTRACT('{"id":"5df8c913e069a09e0467179e","name":"Contacts in description","vote":"REFUSE","notice":{"text":"Contacts or URLs in description are not allowed on JamesEdition","severity":"PROBLEM"},"wordHighlighting":[{"words":[{"word":"yes","regex":"/^yes$/"}],"variableName":"$text.hasUrl"}]}', '$.name')

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM