Is it possible to make Newtonsoft.JSON to chose a class not based on $type
property? For example, I want to deserialize the following JSON
{
"widgets": [
"circle": {
"radius": 1
},
"rectangle": {
"width": 1,
"height": 2
}
]
}
into the following class hierarchy
class WidgetList {
IList<Widget> Widgets { get; set; }
}
abstract class Widget {}
class Circle : Widget {
int Radius { get; set; }
}
class Rectangle : Widget {
int Width { get; set; }
int Height { get; set; }
}