Hi Experts,
I am very new to C# and Azure functions. I am trying to read a JSON message from a Kafka service using Azure function. Requirement is to read the JSON file and create CSV file out of it, load it to DataLake and DataBase.
I am able to read the JSON when the JSON doesn't have any array's in it. I am facing issue when I get array of consigmentes for one header ID. We may get multiple consignments for one OrderID.That time we have to create multiple records considering consigmentID.
Any leads or code to read JSON array data will be really helpful.
Below are the details:
C# code to read JSON to from a CSV file:
string sb = json.header.orderID.ToString() + "," + json.consignments[0].consignmentID.ToString()+ "," + json.consignments[0].shippingAddress.postalCode.ToString() + "," + json.header.country.ToString() + "," + json.consignments[0].warehouseID.ToString()
Input Data:
{
"header":{
"orderID":"008060010",
"country":"GB",
"date":"20210712T143019+0200",
"businessModelID":"0"
},
"consignments":[
{
"pickupPoint":"0",
"consignmentID":"a000000123",
"warehouseID":"W123",
"warehouseRanking":"1",
"shippingAddress":{
"country":"GB",
"postalCode":"SW1A 2AA",
"town":"London"
}
}
]
}
Regards,
Pavan