I am currently returning the following json from a service that I do not own:
{
"auc" : 320658953,
"item" : 31294,
"owner" : "Amacid",
"ownerRealm" : "EarthenRing",
"bid" : 289493,
"buyout" : 371150,
"quantity" : 1,
"timeLeft" : "LONG",
"rand" : 0,
"seed" : 0,
"context" : 0
}, {
"auc" : 321175921,
"item" : 82800,
"owner" : "Drakonys",
"ownerRealm" : "EarthenRing",
"bid" : 7000384,
"buyout" : 7507980,
"quantity" : 1,
"timeLeft" : "VERY_LONG",
"rand" : 0,
"seed" : 161297536,
"context" : 0,
"petSpeciesId" : 293,
"petBreedId" : 9,
"petLevel" : 1,
"petQualityId" : 3
},
And I'm trying to deserialize it to the corresponding CLR objects. Obviously, this object has a hierarchy of objects on the server side; something like Itemand PetItem : Itemwhere it PetItemhas an additional 4 properties at the end.
How can I handle this? I use Json.net to deserialize most of the other results from other services that are more consistent, but I am looking for a strategy to solve such situations. I saw some decisions on how Json.net deserializes everything into an implied base class, but I'm not sure how to handle this boost type scenario.