How can I easily deserialize this JSON to the OrderDto C# class? Is there a way to do this with attributes somehow?
JSON:
{
"ExternalId": "123",
"Customer": {
"Name": "John Smith"
}
...
}
C#:
public class OrderDto
{
public string ExternalId { get; set; }
public string CustomerName { get; set; }
...
}
I tried playing around with the JsonProperty attribute, but wasn't able to get it work. My ideas were to write an annotation like:
[JsonProperty("Customer/Name")]
public string CustomerName { get; set; }
But it just doesn't seem to work. Any ideas? Thx! :)