In your project open or create a C# file (cs file). Copy the sample JSON text to the clipboard. In the C# file use Edit | Paste Special then choose Paste JSON As Classes. You will get code as in the following.
public class Rootobject
{
public Header header { get; set; }
public Consignment[] consignments { get; set; }
}
public class Header
{
public string orderID { get; set; }
public string country { get; set; }
public string date { get; set; }
public string businessModelID { get; set; }
}
public class Consignment
{
public string pickupPoint { get; set; }
public string consignmentID { get; set; }
public string warehouseID { get; set; }
public string warehouseRanking { get; set; }
public Shippingaddress shippingAddress { get; set; }
}
public class Shippingaddress
{
public string country { get; set; }
public string postalCode { get; set; }
public string town { get; set; }
}
Note that consignments is an array of Consignment objects. Then in Solution Explorer right-click the project and choose Manage NuGet Packages.... Install Newtonsoft.Json. Then add using Newtonsoft.Json;
to the program. Then you can read the JSON using something as in the following.
StreamReader sr = new StreamReader(infilename);
string json = sr.ReadToEnd();
Rootobject Root = JsonConvert.DeserializeObject<Rootobject>(json);
An alternative to Newtonsoft is System.Text.Json.Serialization that is part of .Net.