On Sun, 12 Apr 2015 23:48:58 GMT, Konstantin Ilchenko wrote:

Hi!

Lets say I have this structure:

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

if you know the schema a-priori you could use orvids json library:

https://github.com/Orvid/JSONSerialization/tree/master/JSONSerialization

@serializable @ignoreUndefined struct Event { 

   string event;
   ulong code;

  @serializable @ignoreUndefined struct Data { 
    ulongs some; 
    string other; 
   };
   
   Data data; 
  
}


Event ev = fromJSON!Event('{"event": "handshake","code" : 666,"data" : { "some" : 1, "other": "foobar"}}');