I have a RequestModel that contains some properties and another class Consignment.
Calling JsonConvert.SerializeObject(this); returns
{ "consignment": { "collectionDetails": null } }
Instead I would like to return an array of the object
"consignment": [ { "collectionDetails": null } ]
I've tried to create Consignment[] but get a conversion issue.
I've also tried to create a List<Consignment>
class RequestModel
{
public string job_id { get; set; }
public Consignment consignment = new Consignment();
public class Consignment
{
public string consignmentNumber { get; set;
}
public string ToJSON()
{
return JsonConvert.SerializeObject(this);
}
collectionDetailscome from? all i see isconsignmentNumber. Also, why does job_id not show up, are you sure you are reading the correct json?