An Azure service for ingesting, preparing, and transforming data at scale.
Welcome to the Microsoft Q&A and thank you for posting your questions here
To flatten a nested JSON file in Azure Data Factory (ADF) without using data flows, you can use the Copy Activity with a custom mapping. Here are the steps to achieve this:
Create a Pipeline:
- In the Azure portal, navigate to your Data Factory service.
- Click on "Pipelines" and then "Create pipeline."
Add a Copy Activity:
- Drag and drop a "Copy data" activity from the "Activities" pane onto the designer canvas.
Configure the Source:
- Double-click the "Copy data" activity.
- Click on "Source" and choose the dataset where your nested JSON file resides. This could be Azure Blob Storage, ADLS Gen2, or another supported source.
- Select the appropriate format (e.g., JSON) and configure the file path or connection details.
Configure the Sink:
- Click on "Sink" and choose the dataset where you want to save the flattened data. This could be a CSV file in Azure Blob Storage, ADLS Gen2, or another supported destination.
Mapping:
- Click on "Mapping" to define the custom mapping.
- Map the nested JSON fields to the flat structure. You will need to create multiple mappings for each nested array element. For example:
- Map
Design[0]toDesign - Map
Date[0]toDate - Map
Salary[0]toSalary - Repeat for
Design[1],Date[1],Salary[1], etc.
Run the Pipeline:
- Save and run the pipeline to flatten the JSON data and write it to the specified sink.
Hope this helps. Do let us know if you any further queries.________If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.