question

youssef125-3012 avatar image
0 Votes"
youssef125-3012 asked SathyamoorthyVijayakumar-MSFT answered

Convert Json objets to array using Azure data flow

I'm using azure data flow, and I'm using Union to combine two sources, so this union contains JSON documents. is there a way to convert this json document to array of documents:
Union contains :

 {"key":1,"value":"test8"}
 {"key":2,"value":"test6"}
 {"key":3,"value":"test3"}

what I'm looking for is a way to get like this format :

 [
  {
    "key": 1,
    "value": "test8"
  },
 {
  "key": 2,
  "value": "test6"
 },
 {
  "key": 3,
  "value": "test3"
 }
 ]

Thanks for you help

azure-data-factory
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

SathyamoorthyVijayakumar-MSFT avatar image
0 Votes"
SathyamoorthyVijayakumar-MSFT answered

Hello @youssef125-3012,

Welcome to the Microsoft Q&A platform.

Unfortunately, there was not direct approach to achieve the above requirement.

I came up with two possible options

Option 1 :

You can create a collection using the Aggregates Schema Modifier.

143495-image.png

Create a column without any Group and add the below expression.

143512-image.png

Output :

143440-image.png

However, there is an additional key created in the name of the aggregate column provided.

Option 2 :

I outputted the Data flow file to a blob storage and invoked the Copy Activity with the output of the data flow as a source.

I set the sink settings of the Copy Activity to File pattern as Array of Objects

143485-image.png

Output

143531-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



image.png (18.9 KiB)
image.png (7.3 KiB)
image.png (18.4 KiB)
image.png (31.5 KiB)
image.png (22.7 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.