Hi everyone,

I'm taking a look at D again and asked myself, if 
it is possible to write a template mixin or something
similiar that automatically serializes an object to json.

For example:

class MyClass 
{
    string memberA;
    int memberB;
    MyClass memberC;
    mixin ToJson!MyClass;
}

should make possible to automatically output
"someid" { "memberA" : "somestring", 
        "memberB" : 12,
        memberC : "someotherid"};

How could this be accomplished? I've found std.traits
RepresentationTypeTupel but don't see how this would
help me. 

Thanks, 

Tobias

 

Reply via email to