I have JSON coming from 2 different sources that use different structures for the same object.
With JSON.Net, is it possible to have both of these json formats deserialize into the same class structure? Notice one uses JsonProperty and the other has the same property name where the default deserialization process would work.
Source A
{
"Fruit":"Apple"
}
Source B
{
"f":"Apple"
}
Into the same object...
public class Food
{
[JsonProperty("f")]
public string Fruit { get; set; }
}
And if the answer is yes, how is this done (code example would really be helpful!)?