skip to Main Content

How to replace JSON escaping characters in dbt

I have a JSON data like this: {"payload":"{"custom":{"a":{"hs.dl":"hs:\/\/categories\/Z2lkOi8vc2hvcGlmeS9NZW51SXRlbS81NDM2Nzk0NDczODI=","hs.image":"https:\/\/cms-highstreetapp.imgix.net\/denham\/2023\/08\/0657f839-0045-49b0-ba89-fbde3c74f519\/montage20230818-1-kzy7bm.jpg","hs.body":"Reworked in the colours of the season.","hs.video_720":null,"hs.thumbnail":"https:\/\/cms-highstreetapp.imgix.net\/denham\/2023\/08\/0657f839-0045-49b0-ba89-fbde3c74f519\/montage20230818-1-kzy7bm.jpg","hs.title":"Free Move Chinos","hs.video_480":null,"hs.id":"HS_STUDIO-91428"},"i":"31d443e3-1874-4deb-b475-ac10c850451d"},"aps":{"mutable-content":1,"alert":"Free Move Chinos - Reworked in the colours of the season.","category":"category","sound":"default"}}"} Currently, I am replacing escaping characters this way: REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(value, 'hs.', ''), '\"', '"'), '"{',…

VIEW QUESTION

Postgresql – How to speed up range joins in bigquery

Doing self join with same table with range condition. The below is sql statement. select current_rec .* ,compare_rec.employee_id as less_salary_employee from hr.employees current_rec left join hr.employees compare_rec on current_rec.hire_date < compare_rec .hire_date and current_rec.salary < compare_rec.salary order by current_rec .employee_id…

VIEW QUESTION

Json – Extract wildcard key in Bigquery

I have a table with the following structure in bigquery, id desc btjap {"val":{"60fc-4955-8d9b":{"key":"top"},"4f96-4c9e-88f0":{"key":"left"}}} fxlol {"val":{"c783-9342-h73s":{"key":"up"},"83hs-eudu-s839":{"key":"above"}, "37s9-dh3u-39sr":{"key":"right"}}} nretx {"val":{}} The desc column contains multiple wildcard keys as value for the val key . I want to unpack the data into…

VIEW QUESTION
Back To Top
Search