简体   繁体   中英

Parse and Transform JSON Array of strings in sql

I have a table that has a column that contains an array of strings, example ["Emily", "Anna"] , I need to parse this array into 2 columns. Is there a way to do this in sql?

I have tried OPENJSON but this function doesn't work in databricks

Just use the array element indexes:

demo:db<>fiddle

SELECT
    mycolumn[1] AS first_value,
    mycolumn[2] AS second_value
FROM
    mytable

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM