#1 2016-05-20 13:55:18

DigDiver
Member
Registered: 2013-04-29
Posts: 137

ObjecttoJSON with woDateTimeWithZSuffix

When Object contains a packed record with the property of TDateTime type, then the property is stored without "Z". The property with TDateTime type inside the object is stored with "Z".

 Type
  TSettings = packed record
   processed   : Int64;
   startDay    : TDateTime;
 end;

 Type
  TUser = class(TSynPersistent)
 private
  FSettings  : Tsettings;
  flastLogin : TDateTime;
 published
  property Settings    : TSettings   read FSettings    write FSetings;
  property lastLogin   : TDateTime read flastLogin    write flastLogin;
end;
{
	"lastLogin": "2016-05-20T13:40:58Z",
	"Settings": {
		"processed": 73,
		"startDay": "2016-04-05T06:30:23"
	}
}

Offline

Board footer

Powered by FluxBB