Deserializing JSON as an abstract type

Chris cawatson1993 at gmail.com
Tue Nov 19 00:40:16 UTC 2019


So I'm trying to make a D wrapper for Telegram's JSON API using 
libtdjson. All results coming from the JSON API take the 
following structure:

{
   "@type": "className",
   "foo": "bar",
   "baz" {
     "@type": "otherClass"
   }
}

where every object, including nested ones, has a "@type" field 
which will correspond to a D class. There will be over 770 
possible types. So what I'm trying to figure out is how to 
deserialize the JSON so that it automatically gets parsed into 
the correct type.

I'm looking at asdf right now, but it doesn't seem like it has 
anything like that built in. Any ideas?


More information about the Digitalmars-d-learn mailing list