I am trying to extract a value from an array in SparkSQL, but getting the error below:
Example column
customer_details
{"original_customer_id":"ch_382820","first_customer_id":"ch_343948"}
I am using this code:
get_json_object(customer_details, '$.original_customer_id') as customer_id
But I am getting the following error:
error: invalid string interpolation $., expected: $$, $identifier or ${expression}
spark.sql(s"""
error: unclosed character literal (or use " not ' for string literal)
get_json_object(customer_details, '$.original_customer_id') as customer_id,