I want to create JSON with nested arrays and objects like this:
{"orderId": "AF34235",
"recipients": [{"name": "Jane Doe", "address": "123 Main"},
{"name": "Bob Doe", "address": "456 Broad"}],
"sender": {"id": 123, "address": "789 Spruce"}
}
Is this possible with DataContractJsonSerializer
? If so, what should my entity look like?
[DataContract]
class Order
{
[DataMember(Name = "orderId")]
public string OrderId { get; set; }
// what next?
}