I'm working on a project where I have to load files from a JSON file into objects. Let's say that I got the following classes :
- Class Abstract :
Areatype
- Class :
Restaurant
- Class :
Cinema
- Class :
Lobby
Every sub class has other properties, so I can't really figure out how to convert the loaded file into subclasses... I really don't want to handle this with switch
/case
or if
/else
statements because I want to make this dynamically as possible.
So my question is: how can I deserialize into this polymorphism structure?