How to convert rows into array of objects in adf

Shekhar Nadide 186 Reputation points
2022-04-11T06:17:04.643+00:00

I have the below data.

191668-capture.png

I want to convert the above data in to the below format :

{      
        "value" : [  
                        {  
                          "id" : "123",  
                           "name" : "testname"                                                          
                        },  
                        {  
                          "id" : "8459",  
                           "name" : "testname2"                                                
                        }  
                      ]  
}  

Could you please let me know how we can achieve this in data flow.

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

Accepted answer
  1. AnnuKumari-MSFT 32,161 Reputation points Microsoft Employee
    2022-04-12T09:40:33.217+00:00

    Hi @Shekhar Nadide ,

    Thankyou for using Microsoft Q&A platform and posting your query .

    As I understand your requirement here, you want to convert the data present in tabular format to the objects of an array. Please correct me if my understanding is wrong.

    There is no dedicated transformation to achieve the above requirement. However, you can opt for the following approach:

    Use aggregate transformation in data flow. Leave the group by tab as blank and in aggregate tab, provide value as the columnName and use this expression collect(@(id=id,name=name,displayName=displayName)) to get the desired output in the form of array.

    192197-image.png

    192110-image.png

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you.
      Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful