You can consider using the built-in capabilities of Azure Data Factory Mapping Data Flow for JSON parsing.
{
"name": "CustomJSONParsingDataFlow",
"type": "MappingDataFlow",
"activities": [
{
"name": "Source",
"type": "Source",
"output": {
"name": "SourceOutput"
}
},
{
"name": "Flatten1",
"type": "Flatten",
"linkedService": {
"referenceName": "YourLinkedService1",
"type": "LinkedServiceReference"
},
"inputs": [
{
"referenceName": "SourceOutput"
}
],
"outputs": [
{
"referenceName": "FlattenOutput1"
}
]
},
{
"name": "Flatten2",
"type": "Flatten",
"linkedService": {
"referenceName": "YourLinkedService2",
"type": "LinkedServiceReference"
},
"inputs": [
{
"referenceName": "FlattenOutput1"
}
],
"outputs": [
{
"referenceName": "FlattenOutput2"
}
]
},
{
"name": "Sink",
"type": "Sink",
"inputs": [
{
"referenceName": "FlattenOutput2"
}
],
"linkedService": {
"referenceName": "YourDestinationLinkedService",
"type": "LinkedServiceReference"
}
}
]
}
In this example, I've used two Flatten activities to handle multiple levels of nested arrays. Replace placeholders like "YourLinkedService1", "YourLinkedService2", and "YourDestinationLinkedService" with your actual linked services. Adjust the number of Flatten activities based on your JSON structure. Each Flatten activity can be configured to handle a specific level of nesting in your JSON data. This approach utilizes the native capabilities of Data Flow in handling nested structures without custom scripts, which can sometimes improve performance.