Comments (10)
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:
--
*
Date.prototype.toJSONString()
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
already alternate implementations, which could result in incompatible versions
of JSON.
I will ping Douglas Crockford, and see if they have any definitive thoughts on
date
serialization in JSON.
Original comment by mikechambers
on 10 Jan 2007 at 4:51
from as3corelib.
The latest JSON.js file (from December 6, 2006), has support for Dates:
http://www.json.org/json.js
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
Original comment by mikechambers
on 10 Jan 2007 at 5:07
from as3corelib.
Are there any work arounds for this? I'm needing to parse dates from a JSON
feed in
a project I'm working on. The date value comes in from the server as "new Date(-
59011459200000)"
Original comment by wmdmark
on 1 May 2007 at 3:38
from as3corelib.
BTW, I'd be happy to help :)
Original comment by wmdmark
on 1 May 2007 at 3:39
from as3corelib.
until you resolve this you add this to JSONEncoder.as when checking the object
o.
else if (o is Date)
{
s = "new Date(" + o.time.toString() + ")";
return s;
}
else // o is a class instance
Original comment by [email protected]
on 4 Jun 2008 at 10:32
from as3corelib.
It seems that a lot of implementations of JSON are using proprietary date
formats to
get around this issue. This kind of defeats the interoperability aim of JSON. I
would suggest that providing a default serializer/deserializer for dates with
the
ability to insert or use a different one would be useful. In other words,
provide an
interface like
SerializeDate(param:Date):String
IsDate(param:String):bool
DeserializeDate(param:String):Date
where the interface could be changed if the server side technology uses a
different
format.
Like wndmark, I'd be happy to help too.
Original comment by [email protected]
on 5 Jun 2008 at 12:58
from as3corelib.
are there news about it?
Original comment by [email protected]
on 18 Feb 2009 at 11:22
from as3corelib.
Dear all,
I was in need to decode JSON coming from a .NET web service and as3corelib was
the
only solution I found, and after finding out that it does not decode the date I
took
the JSON source files and put them in my own lib and modified the code to check
for
the date string MS sends as json "\/Date(...)\/" and returns a proper date
object.
if anyone is intrested in this let me know.
thanks
Original comment by [email protected]
on 15 Jun 2009 at 3:46
from as3corelib.
Issue 94 has been merged into this issue.
Original comment by darron.schall
on 3 Aug 2009 at 12:59
from as3corelib.
Is any progress being made to this? It's been an issue for going on 3 years.
Original comment by gmariani405
on 21 Sep 2009 at 7:02
from as3corelib.
Related Issues (20)
- BSD License
- PSD parser
- JSONEncoder bug on UTF-8 chars
- Request for StringUtil.contains
- Bug: JSONDecoder does not accept string ending in \u-escape sequence HOT 2
- Enhancement: Use a timer to close the FileTarget log stream. More efficient during heavy logging
- Escaped single quote is not correctly decoded
- Use "valueOf()" to customize JSON object
- Add line numbers to parse errors HOT 2
- JSONParseError: Unexpected c encountered
- After unwatch() is called in FileMonitor, eventListener is removed but is never re-added on watch().
- JSONDecoder fails with token null reference when closing right brace is missing
- FileMonitor onTimerEvent does not fire
- URI.makeAbsoluteURI does not handle local windows filepaths properly HOT 1
- JSON doesn't encode ObjectProxy and ManagedObjectProxy correctly
- JSON Object Problem within ArrayCollection
- JSONParseError: Unexpected e encountered HOT 1
- JSONParseError: Unexpected c encountered
- The HMAC-SHA1 signature generated is different for Ubuntu JAUNTY
- [deleted issue]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from as3corelib.