How to customize vibe.data.json

kerdemdemir kerdemdemir at gmail.com
Fri Mar 30 18:54:16 UTC 2018


On Friday, 30 March 2018 at 17:58:23 UTC, Seb wrote:
> On Friday, 30 March 2018 at 16:47:52 UTC, kerdemdemir wrote:
>> Hi,
>>
>> In vibe's web 
>> page(http://vibed.org/api/vibe.data.json/serializeToJson) it 
>> is told that I should implement
>>
>> [...]
>
> I think you are looking for this - 
> https://github.com/vibe-d/vibe.d/pull/2088
>
> Feel free to ping the people there ;-)

struct RESTTime {
     SysTime time;
     alias time this;
     static RESTTime fromString(string v) { return
     RESTTime(SysTime.fromSimpleString(v)); }
     string toString() const { return time.toSimpleString(); }
}

struct TradeData
{
	UUID   sellOrderID;
	UUID   buyOrderID;	
	
	SysTime buyOrderTime;
	SysTime sellOrderTime;	
}

void main() {
	
	TradeData t;
	Json jsonResult = t.serializeToJson();
	writeln(jsonResult.toString());
	
}

Unfortunately what is shown in the forum is not working with 
SysTime.
My program is being terminated in 
std.datetime.SysTime.toISOExtString() function by code -11.

I hope it does not sound like spoon feeding but do you know any 
solution for SysTime. I am working on it in parallel.

Erdem




More information about the Digitalmars-d-learn mailing list