I\'m writing an app that gets a Json
list of objects like this:
[
{
\"ObjectType\": \"apple\",
\"ObjectSize\": 35,
\"ObjectC
Define base class and derived classes.
the use [JSON.net](also available via NuGet)1 to deserialize them.
I.e.
class ItemToSell {
string Type {get;set;}
string Size {get;set;}
string Cost {get;set;}
}
class Book : ItemToSell { ...}
Then deserialize using
var catalog = JsonConvert.Deserialize>(json);
The deserializer will ignore unexpected properties. Call it again using a specific type to get other properties if you need.