[fpc-devel] TJSONDeStreamer can't handle such date format 'yyyy-MM-dd"T"hh:nn:ss"Z"'

St├ęphane Wierzbicki stephane.wierzbicki at gmail.com
Mon Jul 18 15:20:32 CEST 2016


Hello,

I'm working with the TJSONStreamer and TJSONDeStreamer class. I need to
exchange JSON object with a REST server. Date needs to be formatted this
way : 'yyyy-MM-dd"T"hh:nn:ss"Z"'
Here is what I've done :

Streamer.Options := Streamer.Options + [jsoDateTimeAsString ,
jsoUseFormatString];
Streamer.DateTimeFormat := 'yyyy-MM-dd"T"hh:nn:ss"Z"';  //ISO8601
JSONString := Streamer.ObjectToJSONString(MyObject);
....
DeStreamer.JSONToObject(JSONString , MyObject);  <= Exception

I'm getting an exception when converting my string to the object again.
TJSONDeStreamer failed to convert this format back to
'yyyy-MM-dd"T"hh:nn:ss"Z".

I have modified TJSONStreamer and TJSONDeStreamer class to handle ISO8601
dates by adding a new jsoDateTimeAsISO8601 option.
Where can I send these modifications ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20160718/2472d192/attachment.html>


More information about the fpc-devel mailing list