[pm-h] JSON Dates and DateTime

Michael R. Davis mrdvt92 at yahoo.com
Thu Feb 13 12:15:22 PST 2014


Perl Folks,
I need to call a JSON web service with dates.  The web service uses this format which I hear is a fairly well used JSON date format.  (Note: ISO 8601 is now the preferred format).

 '/Date(1392233750000-0600)/'

What I want to do is to pass DateTime objects to and from the Perl API and have it seamlessly translate to and from this milliseconds from epoch format.

Issues: 
  - I don't see a DateTime formatter that supports this format.  Maybe, I just don't know the name of the format.  But, I was expecting to find DateTime::Format::JSON::Epoch or something similar.
  - I did not see an easy way to use JSON::PP mapping to map objects to strings and back.
I'd hate to have to go through every value searching for strings that matched /Date()/ and convert them to DateTime format.  It's would be easy on the send side as I already have hooks in my code.
Has anyone does this kind of thing before?  I've searched but found nothing on the 'Net related to Perl.

Thanks,
Mike


More information about the Houston mailing list