Hi Kothuri, Sravya,
Thanks for reaching out to Microsoft Q&A.
Check this...
- Source Transformation: Start by reading your data into a data flow. Your source data contains key-value pairs separated by commas.
- Derived Column Transformation:
- Create a new column (let's call it newcol) that converts your existing "Info" column into an array of JSON objects. You can use the following expression:
split(replace(replace(replace(Info, '[', ''), ']', ''), '},{', '}|{'), '|')
This expression removes the square brackets and separates each JSON object using a pipe character (|).
- Flatten Transformation:
- Apply the flatten transformation to the newcol column. This will create separate rows for each JSON object within the array.
- Parse Transformation:
- Use the parse transformation to extract the key-value pairs from the JSON objects. Define the output column type as (key as string, value as string).
- Sink Transformation:
- In the sink settings, disable auto-mapping and manually map the parsed key-value pairs to the appropriate columns. For example, map the "BusinessUnit" key's value to the "BU" column.
By following these steps, you'll be able to extract the "BusinessUnit" key's value and move it to the "BU" column in your output data. This approach is flexible and can handle varying lengths and positions of the key-value pairs within your original column.
There's a similar question which has been answered previously as well...
Please 'Upvote'(Thumbs-up) and 'Accept' as an answer if the reply was helpful. This will benefit other community members who face the same issue.