Member since
02-12-2025
11
Posts
0
Kudos Received
0
Solutions
05-05-2025
06:35 AM
Hi @Rich_Learner can you try this: "SELECT get_json_object(product_json, '$.ProductCOde') AS product_code, get_json_object(product_json, '$.Type') AS product_type FROM customer_table LATERAL VIEW json_tuple(json_column, 'Customer') c AS customer_json LATERAL VIEW json_tuple(customer_json, 'products') p AS products_json LATERAL VIEW explode(from_json(products_json, 'array<map<string,string>>')) product_table AS product_json ;"" OR WITH cleaned_json AS ( SELECT regexp_replace( regexp_replace( get_json_object(json_column, '$.Customer.products'), '\\}\\s*,\\s*\\{', '}~{' ), '\\[|\\]', '' ) AS flat_products FROM customer_table ), split_json AS ( SELECT split(flat_products, '~') AS product_array FROM cleaned_json ) SELECT get_json_object(item, '$.ProductCOde') AS product_code, get_json_object(item, '$.Type') AS product_type FROM split_json LATERAL VIEW explode(product_array) exploded_table AS item; Ensure your JSON keys match case-sensitively and Use consistent JSON structure. If offer is both a number and an array in different objects, consider preprocessing or cleaning up such inconsistencies. Regards, Chethan YM
... View more
04-04-2025
08:29 AM
Thanks for the help and sorry for late reply @Shelton I am getting the output here but the values for parent class are not getting populated, they are displayed as NULL
... View more
02-19-2025
03:36 AM
I am getting the following error in sas FAILED: ParseException line 1:760 cannot recognize input near ';' '<EOF>' '<EOF>' in lateral view
... View more
02-17-2025
07:55 AM
Thanks a lot.. It worked like magic 😄
... View more