-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON cannot encode/decode date instances correctly #5
Comments
Updated by mikechambers on 2007-01-10T04:51:23 Here is the RFC: http://www.ietf.org/rfc/rfc4627.txt?number=4627 I cant find any mention of dates. Here is a page from mozilla's thoughts on EcmaScript 4 and JSON: http://developer.mozilla.org/es4/proposals/json_encoding_and_decoding.html Specifically, it mentions:
Returns a String containing the representation of a date. A Date object is serialized as an ISO date string in double quotes.So, I think it is very important that we follow whatever the "standard" is. There are I will ping Douglas Crockford, and see if they have any definitive thoughts on date |
Updated by mikechambers on 2007-01-10T05:07:34 The latest JSON.js file (from December 6, 2006), has support for Dates: It uses ISO 8601 http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html We have some Data format functions in DateUtils http://as3corelib.googlecode.com/svn/trunk/src/com/adobe/utils/DateUtil.as but unfortunately, dont have ISO 8601 |
Updated by wmdmark on 2007-05-01T03:38:49 Are there any work arounds for this? I'm needing to parse dates from a JSON feed in |
Updated by wmdmark on 2007-05-01T03:39:45 BTW, I'd be happy to help :) |
Updated by kenlarkin on 2008-06-04T10:32:25 until you resolve this you add this to JSONEncoder.as when checking the object o. else if (o is Date) |
Updated by [email protected] on 2008-06-05T12:58:12 It seems that a lot of implementations of JSON are using proprietary date formats to |
Updated by mchiareli on 2009-02-18T23:22:39 are there news about it? |
Updated by noplace on 2009-06-15T03:46:36 Dear all, if anyone is intrested in this let me know. thanks |
Updated by darron.schall on 2009-08-03T00:59:21 Issue 94 has been merged into this issue. |
Updated by gmariani405 on 2009-09-21T19:02:12 Is any progress being made to this? It's been an issue for going on 3 years. |
Darron, I could really use that .net implementation you worked up, could you post some code on how you handled it. Is anyone working on adding this to as3corelib? |
Originally filed by darron.schall on 2006-12-29T20:44:29
What steps will reproduce the problem?
What is the expected output? What do you see instead?
The expected output, unfortunately, is not that well defined. There is no
standard JSON syntax for dealing with dates. A proposed standard is here:
http://www.nikhilk.net/DateSyntaxForJSON2.aspx
Essentially, serializing the date to "@Number@" where number is the number
of milliseconds that have passed since Jan 1, 1970.
Either that, or we can use one of the ISO Date Standard formats.
The output from the trace statement is simply {}. Clearly an empty object
is not good, not matter what the expected output should be.
Please use labels and text to provide additional information.
Whatever sort of serialization we implement should probably be specified
via a flag, passed to the static encode/decode methods. Something like:
JSON.encode( date, JSON.DATE_FORMAT_ISO_8601 );
or
JSON.encode( date, JSON.DATE_FORMAT_AT_MILLIS_AT );
Also, a the decode routine should be specified so that string matching the
encoding format will be converted into true Date instances.
The text was updated successfully, but these errors were encountered: