Hi @Tzu-Ko Hung ,
Welcome to Microsoft Q&A platform and thankyou for posting your question here.
As I understand your issue, you are trying to flatten the data present in a column as array of JSON and convert it into multiple columns. Please let me know if my understanding is incorrect.
Since the data in column3 is in string format, we need to convert it into array first in order to unroll it using flatten transformation . Also, another important point is since the source data is in tabular format, you need to convert it into json format first to apply flatten transformation on top of it.
- Use derived column transformation to create a new column with this expression:
@(column1=column1, column2=column2, column3=split(replace(replace(replace(column3,'[',''),']',''),'},{','};{'), ';'))
- Use select transformation to remove all other columns coming from source.
- Use flatten transformation and unroll by using this new column and select all underlying columns to flatten it.
- Use Parse transformation to create 3 new columns :
column3a
:(a as string)
,column3b
:(b as string)
,column3c
:(c as string)
- Use select transformation to deselect column3 from source.
For more details, kindly watch out : How to flatten and parse the json data of sql column using mapping dataflow
Hope this will help. Please let us know if any further queries.
------------------------------
- Please don't forget to click on and take satisfaction survey whenever the information provided helps you.
Original posters help the community find answers faster by identifying the correct answer. Here is how - Want a reminder to come back and check responses? Here is how to subscribe to a notification
- If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators