Say we have a JSON String like below - { "billingCountry":"US" "orderItems":[ { "itemId":1, "product":"D1" }, { "itemId":2, "product":"D2" } ] } And, our aim is to get output parsed like below - itemId product 1 D1 2 D2 First, We can parse JSON as follows to get JSON String get_json_object(value, '$.orderItems.itemId') as itemId get_json_object(value, '$.orderItems.product') as product Second, Above will result String value like "[1,2]". We want to convert it to Array as follows - split(regexp_extract(get_json_object(value, '$.orderItems.itemId'),'^\\["(.*)\\"]$',1),'","') as itemId split(regexp_extract(get_json_object(value, '$.orderItems.product'),'^\\["(.*)\\"]$',1),&
Comments
Post a Comment