需要有关如何从字符串中提取ID的帮助[关闭]

问题描述 投票:-1回答:1
如何从配置单元(色相)的字符串下面提取以下数字“ CC0002308”

"fClassName":"NotifyAction", "fActions":[ { "type":"ConferenceAction", "properties": { "fClassName":"ConferenceAction", "fName":**"CC0002308"**, "fRecord":false, "fMuted":false, "fStartOnEnter":true, "fEndOnExit":false, "fHangupOnStar":true, "fExtraOptions": { "beepOnExit":true, "beepOnEnter":true, "enableImmediateInput":false } } } ] }

hive bigdata hue
1个回答
0
投票
您可以使用

get_json_object函数从json字符串中提取值!

Example:

select get_json_object(str,'$.fActions[0].properties.fName')fname from ( //sample data select string('{"fClassName":"NotifyAction","fActions":[{"type":"ConferenceAction","properties":{"fClassName":"ConferenceAction","fName":"CC0002308","fRecord":false,"fMuted":false,"fStartOnEnter":true,"fEndOnExit":false,"fHangupOnStar":true,"fExtraOptions":{"beepOnExit":true,"beepOnEnter":true,"enableImmediateInput":false}}}]}') as str )e;

Output:

+---------+ | fname| +---------+ |CC0002308| +---------+
© www.soinside.com 2019 - 2024. All rights reserved.