Hi!

Lets say I have this structure:

{
     "event": "handshake",
     "code" : 666,
     "data" : {
          "some" : 1,
          "other": "foobar"
     }
}

To get event or code is pretty simple

auto json = parseJson(input);
string event = json.event.get!string;

but I don't get how to convert data to any useable type, Variant or associative array, or class instance.

I can do

auto data = json["data"]["other"].get!string;

But what to do, for example, with array of objects of 10 properties?

auto data = json["data"].to!array;

throws

Error: undefined identifier array, did you mean function asArray?
Serializing composite type VariantN!32LU which has no serializable fields

auto data = json["data"].to!object;

throws

Error: template instance to!(object) does not match template declaration to(T)()

class Handshake
{
    int some;
    string other;
}

auto data = json["data"].to!Handshake;

throws

Error: function vibe.data.json.Json.to!(Handshake).to has no return statement, but is expected to return a value of type inout(Handshake)
Error: template instance vibe.data.json.Json.to!(Handshake) error instantiating