Hi,

In vibe's web page(http://vibed.org/api/vibe.data.json/serializeToJson) it is told that I should implement

Json toJson() const;
static T fromJson(Json src);

string toString() const;
static T fromString(string src);

I think I should implement those as member functions(I am not sure).

I have a struct like:

struct TradeData
{
        import std.uuid : UUID;
        import std.datetime : SysTime;

        UUID   sellOrderID;
        UUID   buyOrderID;
        SysTime buyOrderTime;
        SysTime sellOrderTime;  
}

What I want is automatically json conversion of UUID and SysTime classes by returning UUID.toString() and SysTime.toSimpleString() methods when serializeToJson() is being called. Since these are std classes I don't know how can I manipulate them.

Can you please tell me how should I use toJson(), fromJson() functions for customizing user defined objects.

Erdem

Reply via email to