Convert very complex JSON to csv using ADF in Parent (header) child (lineitems) format.

Tanya Garg 0 Reputation points
2025-07-14T18:32:23.44+00:00

I would like to convert complex JSON into csv or fix length format.

There are multiple invoices in json file . One invoice may contain one or more lineitems.

Below is the json format and desired output. Each invoice number will be in header and all lineitems will be in DLT section. After that i will have footer as well. HDF, DLT, FTR will repeat for each invoice give in json .

{

"invoices": [

{

  "INVOICE_NO": "B001R1",

  "Invoice": [

    {

      "InvoiceNum": "B001R1",

      "LesseeCode": "0G98"

    }

  ],

  "Lineitems": [

    {

      "InvoiceNum": "B001R1",

      "LesseeCodeDetail": "0G98",

      "VehicleNo": "0001B"

    }

  ]

},

{

  "INVOICE_NO": "B2r1S1",

  "Invoice": [

    {

      "InvoiceNum": "B2r1S1",

      "LesseeCode": "0G98"

    }

  ],

  "Lineitems": [

    {

      "InvoiceNum": "B2r1S1",

      "LesseeCodeDetail": "0G98",

      "VehicleNo": "12901S"

    }

  ]

},

{

  "INVOICE_NO": "B2R8S2",

  "Invoice": [

    {

      "InvoiceNum": "B2R8S2",

      "LesseeCode": "0G98"

    }

  ],

  "Lineitems": [

    {

      "InvoiceNum": "B2R8S2",

      "LesseeCodeDetail": "0G98",

      "VehicleNo": "15012S"

    }

  ]

},

{

  "INVOICE_NO": "B243861",

  "Invoice": [

    {

      "InvoiceNum": "B243861",

      "LesseeCode": "0G98"

    }

  ],

  "Lineitems": [

    {

      "InvoiceNum": "B243861",

      "LesseeCodeDetail": "0G98",

      "VehicleNo": "1S1006"

    },

    {

      "InvoiceNum": "B243861",

      "LesseeCodeDetail": "0G98",

      "VehicleNo": "1S1006"

    }

  ]

}

]

}

and here is the

User's image

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

1 answer

Sort by: Most helpful
  1. Tanya Garg 0 Reputation points
    2025-07-14T20:39:43.6+00:00

    It did not work as expected. At present , i only used HDR and DLT to make it simple.

    attached is the screen shot of data flow.

    User's image

    and here is the output. Its actually creating it as 2 different columns . and its repeating same header multiple times. Where as Header should appear once for each invoice number and then detailed Line item. Please advise.

    User's image


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.