I have the following JSON returning from a remote API (I cannot change the returned JSON)
{ "APITicket": { "location": "SOMEVALUE", "ticket": "SOMEVALUE" } }
Now, using JSON.Net to convert to this model, I need to create 2 models.
public class TicketModel { public string location { get; set; } public string ticket { get; set; } } public class TicketContainer { public TicketModel APITicket { get; set; } }
and do something like ..
var myObject = JsonConvert.DeserializeObject<TicketContainer>(this.JSONResponse);
and it works well - my problem arises when I have about 50 calls to make an API, and really don't need to create a second βContainerβ for each. Is there a way to bind the example above directly to TicketModel?
source share