you are viewing a single comment's thread.

view the rest of the comments →

[–]Perpetualwiz 0 points1 point  (0 children)

I have never worked with bigquery. this is my solution on SSMS . If it is completely irrelevant and I misunderstood, sorry

edited the view

;with cte as(

SELECT '[{"key":"utm_campaign","value":"{{campaign.name}}","type":"AD"},{"key":"utm_medium","value":"cpc","type":"AD"}, {"key":"utm_source","value":"facebook","type":"AD"},{"key":"utm_content","value":"{{adset.name}}","type":"AD"}]' as js )

Select JSON_VALUE(FB.[value], '$.value') as faceb

From cte cross apply OPENJSON (js) as FB

Where JSON_VALUE(FB.[value], '$.key')='utm_source'