Unmarshaling JSON based on a type defined in the JSON object

I asked a similar question in the gitter chat, but I figured I’d ask here too. Basically this is the issue:

I am attempting to write a Julia wrapper for TDLib, and more specifically for the libtdjson portion of the library. Basically it acts as a JSON interface to Telegram. The JSON objects it sends come in the format

  "@type": "objectType",
  "other_prop": "value",
  "other_object": {
    "@type": "someOtherObject"

where every object has a @type field that should correspond to a struct. So for the above object I’d have

struct ObjectType

struct SomeOtherObject

In reality there are more than 770 types that TDLib defines, all of which will be auto-generated based on the schema. So my question is: is there an existing library or built in method capable of handling a situation like this? Or if not, what would be the best course of action to make deserializing these types as painless as possible. I am new to Julia, so any pointers would be helpful.