1

I have multiple json files in datalake which look like below:

enter image description here

The complex type also have arrays embedded in it.

How can i flatten this json to csv file by either using copy activity or mapping data flows ?

Thanks

azuresnowflake1
  • 135
  • 1
  • 10

3 Answers3

0

To flatten arrays, use the Flatten transformation and unroll each array.

Mark Kromer MSFT
  • 3,578
  • 1
  • 10
  • 11
  • Hi Mark - I followed multiple blogs on this issue but source is failing to preview the data in the dataflow and fails with 'malformed' issue even though the JSON files are valid.. it is not able to parse the files.. are there some guidelines on this? – azuresnowflake1 Jan 30 '22 at 14:17
  • what happens when you click "import projection" in the source? – Mark Kromer MSFT Jan 31 '22 at 08:08
0

As your source Json data contains multiple arrays, you need to specify the document form under Json Setting as 'Array of documents' enter image description here

Then, use flatten transformation and inside the flatten settings, provide 'MasterInfoList' in unrollBy option.Use another flatten transformation to unroll 'links' array to flatten it something like this.

enter image description here

AnnuKumari
  • 443
  • 1
  • 5
0

First check JSON is formatted well using this online JSON formatter and validator.

If source json is properly formatted and still you are facing this issue, then make sure you choose the right Document Form (SingleDocument or ArrayOfDocuments).

Also refer this Stackoverflow answer by Mohana B C

Abhishek K
  • 3,047
  • 1
  • 6
  • 19