temalcode
temalcode

Reputation: 21

Remove Top-Level Field and and Preveserve Only Values in Azure Data Factory

I want to remove the top-level field name and only preserve the values and save it as a file using Azure Data Factory. The JSON is consists of array of objects.

Current JSON

"response" : [
  {},
  {},
  {}
]

Requirement

[
  {},
  {},
  {}
]

Upvotes: 0

Views: 38

Answers (1)

Rakesh Govindula
Rakesh Govindula

Reputation: 11489

You need to change the copy activity mapping as per your requirement.

First, I took the below data as my starting JSON input file.

{
"response":
[
    {
        "name":"PipelineName",
        "type":"string"
    },
    {
        "name":"Status",
        "type":"string"
    },
    {
        "name":"TimeGenerated",
        "type":"datetime"
    },
    {
        "name":"_ResourceId",
        "type":"string"
    },
    {
        "name":"Type",
        "type":"string"
    }
]
}

After adding both source and sink JSON datasets in the copy activity, go to mapping and enable the Advanced editor by giving your JSON array key name as shown below.

enter image description here

Now, to make the result as JSON array, select the file pattern in the sink as Array of objects.

enter image description here

Execute the copy activity and the result JSON file will be generated in the required format.

enter image description here

Upvotes: 0

Related Questions