I'm a beginner when it comes to JSON and am trying to figure out how to parse this. For example, how would I go about extracting utm_source? It should say facebook in the example below:
declare @json as varchar(2500) = '[{"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"}]'
SELECT * FROM OPENJSON(@json)
WITH ( [key] VARCHAR(150),
value VARCHAR(150),
type VARCHAR(150)
) as months;
SELECT * FROM OPENJSON(@json)
WITH ( value VARCHAR(150) '$.value') as months;