How to get json in proper format in copy activity output

Bansal, Ankit Kumar 25 Reputation points
2023-05-22T07:46:04.3066667+00:00

i am using copy activity to fetch the data from API and create json file. the pipeline was successful but only one row was created in the following format

{

  "headings": ["id","name","standard"],

  "rows": [

    [1,"ankit",1],

    [2,"rahul",2],

    [3,"priya",2]

  ]

}

It is difficult to perform transformations on this format of json. I want to convert this json file into a csv file or want to store data of json in a table.

Is it possible to get below type json using any settings of copy activity

{

  "students": [

    {

     "id":1,"name":"ankit","standard":1

    },

    {

      "id":1,"name":"rahul","standard":2

    },

    {

      "id":1,"name":"priya","standard":2

    }    

  ]

}

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,135 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ShaikMaheer-MSFT 38,326 Reputation points Microsoft Employee
    2023-05-23T09:31:22.1866667+00:00

    Hi Bansal, Ankit Kumar,

    Thank you for posting query in Microsoft Q&A Platform.

    Under copy activity, navigate to mappings tab to control the schema of your sink. Instead of writing data to json. You can directly try writing data to csv as well.

    Please note, make sure you import schema in your source dataset, which is fetching data from API. Under Copy activity mappings tab consider hitting import schemas. Once you see schemas there play with mappings between source and sink as per requirement.

    User's image

    Hope this helps. Please let me know how it goes and if any further queries.


    Please consider hitting Accept Answer button. Accepted answers help community as well.